赞
踩
用<a>中的方<a>中的函数<b>()
绘制五角星
- import turtle #引进库
- def main(): #定义mian函数
- count = 1 #定义计数器
- #绘制五角星
- while count <= 5:
- turtle.forward(150)
- turtle.right(144)
- count += 1
- turtle.exitonclick()
- if __name__=='__main__':
- main()
重叠的五角星
- import turtle
- def drwa_pentagram(size):
- count = 1
- while count <= 5:
- turtle.forward(size)
- turtle.right(144)
- count += 1
- def main():
- turtle.penup()
- turtle.backward(200)
- turtle.pendown()
- size = 50
- while size <= 500:
- # 调用绘制五角星函数
- drwa_pentagram(size)
- # size = size + 10
- size += 10
- turtle.exitonclick()
- if __name__ == '__main__':
- main()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。