0

I'm making a little game. I want to give players points when they give a fast answer. So, I made a countdown for 10 seconds. But when I try to establish the remaining seconds, I get an error.

Code:

#variable: 10 seconds
Countdown = 10

#function to count down seconds
def Timer(Countdown):
    while Countdown:
        time.sleep(1)
        Countdown -= 1

#variable to see how many seconds remain (this is inside another function, when the player hits the button)
Time = Countdown

I get the error: UnboundLocalError: cannot access variable 'Countdown' where it is not associated with a value.

Djonie
  • 3
  • 3

0 Answers0