Lesson 11: Python Turtle

posted Jan 16, 2020, 9:05 AM by Attila Lengyel
import turtle

bob = turtle.Turtle()
bob.forward(80)

bob.left(90)
bob.forward(80)

bob.left(90)
bob.forward(80)

bob.left(90)
bob.forward(80)

bob.clear()

bob.shape("turtle")
bob.pencolor("red")

for i in range(4):
bob.left(90)
bob.forward(80)
bob.clear()

bob.left(90)

for i in range(5):
bob.fd(80)
bob.right(144)

bob.clear()

sides = int(input("How many sides?:"))
side_length = int(input("Length?:"))

for i in range(sides):
bob.forward(side_length)
bob.right(360/sides)
Comments