I am trying to speed up my turtle whenever I press the space bar.
I have a code that looks something like this
import turtle
instructions = [20,30,40,20,50,5,20,30,40,200,5]
speed = 0
wn = turtle.Screen()
drone = turtle.Turtle()
speed = 1
def sped():
global speed
speed += 1
for instruction in instructions:
drone.forward(instruction)
drone.left(45)
wn.onkey(sped, "space")
drone.speed(speed)
print(speed)
However, the speed is always 1. I've tried scouring the internet but nothing comes up. How do I fix this?