Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import turtle
- def draw(t, length, n):
- if n == 0:
- return
- angle = 50
- t.fd(length*n)
- t.lt(angle) ## create flower to the left side
- draw(t, length, n-1)
- t.rt(2*angle) ## create a flower to the right side
- draw(t, length, n-1)
- t.lt(angle) ## turn the direction back
- t.bk(length*n) ## and go back to the previous position
- """
- Use cases
- """
- t = turtle.Turtle()
- draw(t, 10, 5)
- # draw(t, 10, 2)
- # wait for the user to close the window
- turtle.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement