
Lv.1
签名:已润
在 【Python作品分享】清华大学的录取题目(共五道)【作品秀】 中回复
..............................................................
2019-09-14T16:50:20 点赞:0
在 【Python作品分享】随机画正方形-【作业帖】 中回复
import random
import turtle as t
t.pensize(0)
n=100 #此处是星星的数量
Colors = ['red', 'yellow', 'blue', 'green','orange', 'purple', 'white', 'gray','skyblue']
for i in range(n):
v = random.randint(10, 40)
x = random.randint((-300), 300)
y = random.randint((-300), 300)
q = random.choice(Colors)
t.bgcolor("black")
t.speed(0)
t.pencolor(q)
for j in range(v):
t.forward(j)
t.right(144)
t.penup()
t.goto(x, y)
t.pendown()
t.mainloop()
2019-09-14T18:42:23 点赞:0