如何用交替颜色排列一排正方形画作?

2026-05-26 18:041阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计117个文字,预计阅读时间需要1分钟。

如何用交替颜色排列一排正方形画作?

pythonfrom turtle import *from random import *

speed(0)penup()goto(-190, 0)pendown()

for j in range(8): color(random.choice(['red', '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()


如何用交替颜色排列一排正方形画作?


本文共计117个文字,预计阅读时间需要1分钟。

如何用交替颜色排列一排正方形画作?

pythonfrom turtle import *from random import *

speed(0)penup()goto(-190, 0)pendown()

for j in range(8): color(random.choice(['red', '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()


如何用交替颜色排列一排正方形画作?