Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
272 B
0
Indexable
Never
import time

def countdown(t):
    while t:
        mins, secs = divmod(t, 60)
        timer = '{:02d}:{:02d}'.format(mins, secs)
        print(timer, end="\r")
        time.sleep(1)
        t -= 1
    print('Time is up!')

countdown(300) # 5 minutes in seconds