Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #brings the library that allows time and sleep in and renames it to t
- import time as t
- #sleep is defined as time.sleep(duration)
- #def defines a function
- #sec is a function of the library
- #this is where the countdown starts
- def stopwatch(sec):
- while sec:
- #while executes statements as long as a condition is true
- minn, secc = divmod(sec, 60)
- timeformat = '{:02d}:{:02d}'.format(minn, secc)
- print(timeformat, end='\r')
- t.sleep(1)
- sec -= 1
- stopwatch(60)
- print('Goodbye!\n')
Advertisement
Add Comment
Please, Sign In to add comment