Python Forum
Making turtle draw a sine wave recursively
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making turtle draw a sine wave recursively
#1
Definitely worth running once Rolleyes

#! /usr/bin/python3 # Recursively drawing a sine wave from turtle import * import time import math def draw_sine(x): if not x < 50: print("done") else: y = 30 * math.sin(.5 * x) setx(x) sety(y) penup() goto(x, y) dot() pendown() draw_sine(x + .25) if __name__ == "__main__": x = -50 penup() draw_sine(x) time.sleep(100)
Reply
#2
Nice job.
Reply
#3
Thank you kindly Wink
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Electron wave function NUMA01 0 2,644 Sep-25-2020, 01:23 PM
Last Post: NUMA01
  Recursively place file in a directory/all subdirectories rootVIII 2 4,188 Dec-26-2018, 09:23 PM
Last Post: rootVIII

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.