Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # t_square_spiral.py
- import turtle
- t = turtle
- colors = ['blue', 'green', 'yellow', 'orange', 'red']
- def spiral(t, step, step_incr, angle):
- color_ind = 0
- colors_len = len(colors)
- t.pencolor(colors[color_ind])
- while True:
- t.forward(step)
- step = step + step_incr
- if step > 500:
- break
- t.right(angle)
- color_ind = (color_ind + 1) % colors_len
- t.pencolor(colors[color_ind])
- t.hideturtle()
- t.speed(0)
- spiral(t, 20, 5, 90.2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement