teacher_code_python/循环.py

18 lines
390 B
Python

import turtle
import random
n=int(input())
turtle.speed(0)
turtle.pensize(10)
turtle.fillcolor("red")
turtle.begin_fill()
for j in range(18):
for i in range(n):
r = random.random()
g = random.random()
b = random.random()
turtle.pencolor(1, g, b)
turtle.forward(100)
turtle.right(360/n)
turtle.right(20)
turtle.end_fill()
turtle.done()