Lesson 12: Turtle is here... simple drawing with Python Turtle

posted Jan 14, 2020, 8:05 AM by Attila Lengyel
import turtle as t

jojo_siwa = t.Turtle()

jojo_siwa.forward(50)
jojo_siwa.right(90)

jojo_siwa.forward(50)
jojo_siwa.right(90)

jojo_siwa.forward(50)
jojo_siwa.right(90)

jojo_siwa.forward(50)
jojo_siwa.right(90)


for i in range (0,4):
jojo_siwa.forward(50)
jojo_siwa.left(90)

jojo_siwa.clear()

for i in range(0,5):
jojo_siwa.forward(50)
jojo_siwa.right(144)

jojo_siwa.clear()

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

angle = 360 / num_sides
for i in range(0,num_sides):
jojo_siwa.forward(side_length)
jojo_siwa.right(angle)


jojo_siwa.done()


Comments