您的位置:首页 > 编程语言 > Python开发

Think In Python Exercise

2015-06-30 22:56 603 查看

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()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: