Python雪花

Python雪花,第1张

Python雪花
import turtle
def show(n,size):
    if n==1:
        turtle.fd(size)
    else:
        for angle in [0,60,-120,60]:
            turtle.left(angle)
            show(n-1,size/3)
turtle.setup(800,800)
turtle.penup()
turtle.goto(-200,100)
turtle.pendown()
turtle.pensize(2)
level=3
show(level,400)
turtle.right(120)
show(level,400)
turtle.right(120)
show(level,400)
turtle.right(120)
turtle.done()#窗口保持

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5711707.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-17
下一篇2022-12-17

发表评论

登录后才能评论

评论列表(0条)

    保存