The example of event-driven code from the options provided is:
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. The wn.onkey(h1, "Up")
line registers the function to be called when the specified key event occurs (i.e., pressing the "Up" key), which is characteristic of event-driven programming.