Try one Exercise on ”Think in Python”
Write an appropriately general set of functions that can draw flowers as in Figure as below:
# practice version 0.1
from polygon import *
world = TurtleWorld()
bob = Turtle()
##print(bob)
# world = TurtleWorld()
# bob = Turtle()
# print bob
def flower1(t, num, r):
## angle of one arc
inner_total_angle = 180*(num-2)
inner_angle = float(inner_total_angle)/num
angle = inner_angle*2
t_angle = 180 - inner_angle
for i in range(num):
arc(t, r, angle)
lt(t, t_angle)
def flower2(t, num, r):
bob.delay = 0.001
flower2(bob, 10, 50)
wait_for_user()