Lesson 22: Turtle in corners and timer

posted Jun 5, 2019, 8:05 AM by Attila Lengyel
import turtle as t

bob = t.Turtle()
bob.shape("turtle")
def move(x,y,corner):
bob.clear()
bob.speed(0)
bob.penup()
bob.goto(x,y)
bob.pendown()
for x in range(0,3):
bob.forward(40)
bob.left(120)

def turtlewrite(message):
bob.write(message, font=("Arial", 64, "normal"))

import time
import random

def select():
for x in range(0,7):
bob.clear()
turtlewrite(7 - x)
time.sleep(1)

corner = random.randint(1,4)
if corner == 1:
move(200, 200, 1)
elif corner == 2:
move(-200, 200, 2)
elif corner == 3:
move(-200, -200, 3)
else:
move(200, -200, 4)

for x in range(0,10):
select()
time.sleep(2)
move(0,0,0)
Comments