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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM