Created
October 10, 2017 02:17
-
-
Save Richienb/f1c3d85bc4d0b2addbe8e41c62900b04 to your computer and use it in GitHub Desktop.
Simple Python Stopwatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
seconds = 0 | |
minutes = 0 | |
hours = 0 | |
mseconds = 0 | |
while True: | |
print(hours, ":", minutes, ":", seconds, ":", mseconds) | |
time.sleep(0.01) | |
if minutes == 59: | |
hours += 1 | |
minutes = 0 | |
if seconds == 59: | |
seconds = 0 | |
minutes += 1 | |
if mseconds == 59: | |
seconds += 1 | |
mseconds = 0 | |
else: | |
mseconds += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment