forked from geekcomputers/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleStopWatch.py
More file actions
19 lines (17 loc) · 650 Bytes
/
SimpleStopWatch.py
File metadata and controls
19 lines (17 loc) · 650 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#Author: OMKAR PATHAK
#This script helps to build a simple stopwatch application using Python's time module.
import time
print('Press ENTER to begin, Press Ctrl + C to stop')
while True:
try:
input() # For ENTER. Use raw_input() if you are running python 2.x instead of input()
starttime = time.time()
print('Started')
while True:
print('Time Elapsed: ', round(time.time() - starttime, 0), 'secs', end="\r")
time.sleep(1)
except KeyboardInterrupt:
print('Stopped')
endtime = time.time()
print('Total Time:', round(endtime - starttime, 2),'secs')
break