Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def drag(l, n, angle=45):
- L = l * 2 ** .5 / 2
- if n == 1:
- turtle.rt(angle)
- turtle.fd(L)
- turtle.lt(angle * 2)
- turtle.fd(L)
- turtle.rt(angle)
- else:
- turtle.rt(angle)
- drag(L, n - 1)
- turtle.lt(angle * 2)
- drag(L, n - 1, angle=-angle)
- turtle.rt(angle)
- colors = ["black", "red", "green", "blue", "cyan", "yellow", "magenta"]
- for i in range(1, 4):
- turtle.width(10 - i * 2)
- turtle.color(colors[i])
- drag(300, i)
- restart()
- turtle.exitonclick()
Advertisement
Add Comment
Please, Sign In to add comment