python/2024-7-10-2.py

85 lines
2.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

b=int(input())
c=int(input())
import turtle
t=turtle.Turtle()
a=turtle.Turtle()
t.speed(0)
a.speed(0)
t.left(90)
t.pensize(5)
a.pensize(5)
t.goto(0,0)
a.penup()
a.goto(200,0)
a.pendown()
d=0
e=0
f=0
g=0
while 1:
for i in range(10):
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor(e,f,g)
t.forward(c)
t.left(360/b)
a.pencolor(e,f,g)
a.forward(c)
a.left(360/b)
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor("white")
t.forward(c)
t.left(360/b)
a.pencolor("white")
a.forward(c)
a.left(360/b)
d=d+1
e=d/10
if e>0.9:
e=0
d=0
f=f+0.1
if f>0.9:
f=0.1
g=g+0.1
if g>0.9:
g=0
a.backward(20)
for i in range(2):
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor(e,f,g)
t.forward(c)
t.left(360/b)
a.pencolor(e,f,g)
a.forward(c)
a.left(360/b)
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor("white")
t.forward(c)
t.left(360/b)
a.pencolor("white")
a.forward(c)
a.left(360/b)
t.forward(c)
for i in range(10):
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor(e,f,g)
t.forward(c)
t.left(360/b)
a.pencolor(e,f,g)
a.forward(c)
a.left(360/b)
for i in range(b):#for循环结构,range()函数迭代器list,tuple...
t.pencolor("white")
t.forward(c)
t.left(360/b)
a.pencolor("white")
a.forward(c)
a.left(360/b)
a.backward(20)
t.goto(0,0)
a.penup()
a.goto(200,0)
a.pendown()
turtle.down()