30 lines
485 B
Python
30 lines
485 B
Python
import turtle
|
|
|
|
my_screen = turtle.Screen()
|
|
terry = turtle.Turtle()
|
|
|
|
# Regular octagon in red
|
|
terry.pencolor("red")
|
|
terry.pendown()
|
|
|
|
count = 0
|
|
while count < 8:
|
|
terry.forward(50)
|
|
terry.right(45) # 360 / 8
|
|
count += 1
|
|
|
|
# Move turtle so shapes don't overlap
|
|
terry.penup()
|
|
terry.forward(200)
|
|
|
|
# Regular nonagon in blue
|
|
terry.pencolor("blue")
|
|
terry.pendown()
|
|
|
|
count = 0
|
|
while count < 9:
|
|
terry.forward(50)
|
|
terry.right(40) # 360 / 9
|
|
count += 1
|
|
|
|
my_screen.exitonclick() |