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()
相关文章推荐
- python 简单图像处理(13)
- Python学习之二【初学Python】
- 最近在学习python
- python装饰器
- python 优秀文章索引
- python编程之键盘响应
- Python学习十四:filter()
- Python图像处理(12):贝叶斯分类器
- python脚本
- Python实现决策树算法
- Python学习十三:map/reduce
- Python Decorator
- windows系统下Python环境的搭建
- Python LoggerAdpater类
- python ConfigParse模块(转)
- Python-strip()方法
- python中的元类metaclass
- Python文件操作
- Python读写文件实际操作的五大步骤
- python super()