10-2
This commit is contained in:
parent
0b1bc5868e
commit
9ae1329cdf
34
2024.7.16.py
34
2024.7.16.py
|
@ -1 +1,33 @@
|
||||||
print(6)
|
import turtle
|
||||||
|
import random
|
||||||
|
t=turtle.Turtle()
|
||||||
|
t.speed(0)
|
||||||
|
for j in range(100):
|
||||||
|
x=random.randint(-400,400)
|
||||||
|
y = random.randint(-400, 400)
|
||||||
|
step=random.randint(40,100)
|
||||||
|
t.penup()
|
||||||
|
t.goto(x,y)
|
||||||
|
t.pendown()
|
||||||
|
for i in range(0,6):
|
||||||
|
r = random.random()
|
||||||
|
g = random.random()
|
||||||
|
b = random.random()
|
||||||
|
t.pencolor(1, g, b)
|
||||||
|
t.forward(step)
|
||||||
|
t.penup()
|
||||||
|
t.backward(step//2)
|
||||||
|
t.pendown()
|
||||||
|
t.left(45)
|
||||||
|
t.forward(int(0.45*step))
|
||||||
|
t.penup()
|
||||||
|
t.backward(int(0.45*step))
|
||||||
|
t.pendown()
|
||||||
|
t.right(90)
|
||||||
|
t.forward(int(0.45*step))
|
||||||
|
t.penup()
|
||||||
|
t.backward(int(0.45*step))
|
||||||
|
t.left(45)
|
||||||
|
t.backward(int(0.5*step))
|
||||||
|
t.left(60)
|
||||||
|
t.pendown()
|
||||||
|
|
Loading…
Reference in New Issue