The example of event-driven code from your options is:
import turtle
t = turtle.Turtle()
wn = turtle.Screen()
def h1():
t.forward(30)
wn.onkey(h1, "Up")
In this code, the function h1
is defined to move the turtle forward when the "Up" key is pressed. This is a clear example of event-driven programming, where actions are triggered by specific events (in this case, a key press).