six-quick-python-projects/countdown.py
2021-03-25 08:58:09 -04:00

14 lines
No EOL
292 B
Python

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('Countdown complete!')
t = input("Enter the time in seconds: ")
countdown(int(t))