Lesson 17: Drawing with Turtle

posted Apr 10, 2019, 8:01 AM by Attila Lengyel
import turtle

ted = turtle.Turtle()

for i in range(0,4):
ted.forward(50)
ted.left(90)
ted.write("Turn left")

ted.penup()
ted.setposition(-100,-100)
ted.pendown()

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

ted.clear()

ted.pencolor("blue")
ted.circle(100)

ted.clear()
ted.penup()
ted.setposition(0,0)
ted.pendown()

num_sides = 5
side_length = 10
angle = 360 / num_sides

for i in range(0,num_sides):
ted.forward(side_length)
ted.right(angle)
Comments