1 Star 1 Fork 0

小染大大 / turtle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
7.彩色光球.py 572 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiaoming 提交于 2019-11-17 01:44 . first commit
import turtle as t
import random
t.speed('fast')
t.hideturtle()
t.bgcolor('black')
i = 0
temp = ''
colors = ['blue', 'red', 'yellow', 'green', 'cyan', 'purple',
'white', 'orange', 'brown']
while i < 180:
rand_color = random.choice(colors)
while rand_color == temp:
rand_color = random.choice(colors)
t.pencolor(rand_color)
t.penup()
t.goto(0, 0)
t.forward(100)
t.pendown()
if i % 2 == 0:
t.forward(300)
else:
t.forward(200)
t.left(2)
i += 1
temp = rand_color
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiaoran-dada/turtle.git
git@gitee.com:xiaoran-dada/turtle.git
xiaoran-dada
turtle
turtle
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891