import turtle
t = turtle.Turtle()
t.speed(0)
t.width(2)
# 1. Круги (касаются друг друга)
for i in range(10):
if i % 3 == 0:
t.pencolor("red")
if i % 3 == 1:
t.pencolor("green")
if i % 3 == 2:
t.pencolor("blue")
t.penup()
t.goto(-430 + i * 40, 80 + i * 40)
t.pendown()
t.circle(20)
# 2. Линии (20 штук)
for i in range(20):
if i % 4 == 0:
t.pencolor("red")
if i % 4 == 1:
t.pencolor("cyan")
if i % 4 == 2:
t.pencolor("blue")
if i % 4 == 3:
t.pencolor("green")
t.penup()
t.goto(250, 220)
t.setheading(i * 18)
t.pendown()
t.forward(120)
# 3. Углы (10 штук, чуть правее)
t.penup()
t.goto(-370, -200)
t.setheading(0)
t.pendown()
for i in range(10):
if i % 4 == 0:
t.pencolor("red")
if i % 4 == 1:
t.pencolor("green")
if i % 4 == 2:
t.pencolor("blue")
if i % 4 == 3:
t.pencolor("orange")
t.left(45)
t.forward(25)
t.right(90)
t.forward(25)
t.left(45)
# 4. Квадраты (больше, на том же месте)
for i in range(20):
t.penup()
t.goto(250, -220)
t.setheading(i * 9 + 45)
t.forward(70)
t.left(135)
if i % 4 == 0:
t.pencolor("red")
if i % 4 == 1:
t.pencolor("cyan")
if i % 4 == 2:
t.pencolor("blue")
if i % 4 == 3:
t.pencolor("orange")
t.pendown()
for j in range(4):
t.forward(120)
t.left(90)
turtle.done()