Guest User

Untitled

a guest
Nov 29th, 2020
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. #brings the library that allows time and sleep in and renaims it to t
  2. #sleep is defined as time.sleep(duration)
  3. import time as t
  4. #def defines a function
  5. #sec is a function of the library
  6. #this is where the countdown starts
  7. def stopwatch(time):
  8.     while time:
  9.     #while exectues statements as long as a condition is true
  10.             minn, secc = divmod(time, 60)
  11.             timeformat = '{:02d}:{:02d}'.format(minn, secc)
  12.             print(timeformat, end='\r')
  13.             t.sleep(1)
  14.             time -= 1
  15. uTime = input("How long to countdown? ")
  16. stopwatch(uTime)
  17. print('Goodbye!\n')
Advertisement
Add Comment
Please, Sign In to add comment