Guest User

Zway 1

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