main.py 288 B

123456789101112131415
  1. import time
  2. def countdown(t):
  3. while t:
  4. mins, secs = divmod(t, 60)
  5. timer = '{:02d}:{:02d}'.format(mins,secs)
  6. print(timer, end="\r")
  7. time.sleep(1)
  8. t -= 1
  9. print('Timer completed!')
  10. t = input('Enter the time in seconds: ')
  11. countdown(int(t))