当前位置 : 主页 > 编程语言 > python >

交替颜色画一排正方形

来源:互联网 收集:自由互联 发布时间:2022-06-18
from turtle import * from random import * speed ( 0 ) penup () goto ( - 190 , 0 ) pendown () for j in range ( 8 ): if j % 2 == 0 : color ( 'red' ) else : color ( 'blue' ) begin_fill () for i in range ( 4 ): fd ( 30 ) left ( 90 ) end_fill ()


from turtle import *
from random import *
speed(0)
penup()
goto(-190,0)
pendown()

for j in range(8):
if j%2==0:
color('red')
else:
color('blue')
begin_fill()
for i in range(4):
fd(30)
left(90)
end_fill()
penup()
goto(-190+(j+1)*50, 0)
pendown()

input()



上一篇:整数划分(python)
下一篇:没有了
网友评论