标签:awt mic def The bsp img lag com info
import turtle
def drawTriangle(num,len,flag
flag*=-1
len/=2
if(num==1):
if(flag==1):
turtle.left(60)
turtle.fd(len)
turtle.right(120)
turtle.fd(len)
turtle.right(120)
turtle.fd(len)
turtle.left(120)
else:
turtle.right(60)
turtle.fd(len)
turtle.left(120)
turtle.fd(len)
turtle.left(120)
turtle.fd(len)
turtle.right(120)
else:
if(flag==1):
turtle.left(60)
turtle.fd(len/2)
num=num-1
turtle.right(60)
drawTriangle(num,len,flag)
turtle.fd(len/2)
turtle.right(120)
turtle.fd(len)
turtle.right(120)
turtle.fd(len)
turtle.left(120)
else:
turtle.right(60)
turtle.fd(len/2)
num=num-1
turtle.left(60)
drawTriangle(num,len,flag)
turtle.fd(len/2)
turtle.left(120)
turtle.fd(len)
turtle.left(120)
turtle.fd(len)
turtle.right(120)
def main():
turtle.setup(600,600, 200, 200)
turtle.pendown()
turtle.speed(2)
turtle.pensize(5)
drawTriangle(5,512,-1)
turtle.hideturtle()
main()
turtle.done()#which returns after the main loop exits
标签:awt mic def The bsp img lag com info
原文地址:https://www.cnblogs.com/567823a/p/12500217.html