Python入门_绘制多个五角形_turtle

 

 

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

优化: 运行更快; 更简洁

1. turtel 库: 

2. 绘图坐标体系:

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

 

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.递归函数:调用自身函数的函数

 

posted @ 2019-03-24 10:37  Jenny测试开发  阅读(1811)  评论(0编辑  收藏  举报