I'm attempting to make a countdown timer starting from 60 seconds. My only problem is that when I run the function, the program prints the code like so:
60
59
58
... etc
How would I go about replacing the 60 from that first line and put the 59 in it's place without printing 60 lines?
Here's my code:
from __future__ import division
import sys, time
def countdown():
seconds = 60
while seconds >= 0:
print seconds
sys.stdout.flush()
time.sleep(1)
seconds -= 1