Python
import turtle as t import random def star(f,c,r): t.tracer(0) t.color(c) t.seth(r) t.fillcolor(c) t.begin_fill() for i in range(5): t.forward(f) t.left(144) t.end_fill() t.update() f = int(input('星星的边长:')) c = input('请输入颜色:') for i in range(50): t.penup() x = random.randint(-200,200) y = random.randint(-150,150) r = random.randint(0,360) t.goto(x,y) t.pendown() star(f,c,r)