Python入门_分形树的绘制_turtle

汇率兑换的程序已经实现了; 

优化: 运行更快; 更简洁

1. turtel 库: 

2. 绘图坐标体系:

https://docs.python.org/3.0/library/turtle.html

扫描二维码关注公众号,回复: 5636980 查看本文章
import turtle

def draw_wujiao(size):
count = 1
while count <= 5:
turtle.forward(size)
turtle.right(144)
count = count + 1

def main():
#循环的魅力,可以循环多次实现相同的操作
turtle.penup()
turtle.backward(200)
turtle.pendown()
turtle.pensize(2)
turtle.pencolor('red')

size = 50
while size <= 60:
draw_wujiao(size)
size += 10

turtle.exitonclick()

if __name__ == '__main__':
main()

 3.递归函数:调用自身函数的函数

猜你喜欢

转载自www.cnblogs.com/jiangkeji/p/10585489.html
今日推荐