Advertisement
Guest User

timer.py

a guest
Aug 18th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. from time import sleep
  2.  
  3. hours = 0
  4. minutes = 0
  5. seconds = 0
  6.  
  7. while True:
  8.     if seconds == 60:
  9.         minutes += 1
  10.         seconds = 0
  11.     if minutes == 60:
  12.         hours += 1
  13.         minutes = 0
  14.     print("{:02d}:{:02d}:{:02d}".format(hours, minutes, seconds), end='\r')
  15.     sleep(1)
  16.     seconds += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement