|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import turtle as t
t.setup(400,400)
t.bgcolor("black")
t.speed(0)
t.penup()
def square(a):
t.pendown()
t.begin_fill()
for i in range(4):
t.forward(a)
t.right(90)
t.end_fill()
t.penup()
t.color("white","yellow")
n = 1
y = 200
for i in range(10):
t.goto(-200,y)
for j in range(10):
if n % 7 == 1:
t.color("red")
elif n % 7 == 2:
t.color("orange")
elif n % 7 == 3:
t.color("yellow")
elif n % 7 == 4:
t.color("green")
elif n % 7 == 5:
t.color("cyan")
elif n % 7 == 6:
t.color("blue")
else:
t.color("purple")
square(40)
t.forward(40)
n += 1
y -= 40
t.hideturtle()
t.done()
|
|