I am trying to write a simple countdown timer and for some reason, when I run the script it hangs up and does nothing.
# countdown one minute
import time
countdown = 60
while countdown > 0:
print(str(countdown), end=' ')
countdown -= 1
time.sleep(1)
The problem has something to do with the sleep function, although I’m not sure why. If I comment out that line, the loop prints out all the numbers. Also if I step through the code with the debugger (VSCode), the countdown works as expected. But when I simply run the script in the terminal, nothing happens. Very confused. I am running Python 3.9.1 on Manjaro Linux, just in case that’s of any consequence.