forked from anshrathod/Basic-Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLapTimer.py
More file actions
34 lines (24 loc) · 788 Bytes
/
Copy pathLapTimer.py
File metadata and controls
34 lines (24 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import time
# Timer starts
Start=time.time()
Last=Start
Lap_No=1
print("Count Laps: Press ENTER")
print("Stop: Press CTRL+C")
try:
while True:
input() #If user presses enter
# The current lap-time
Lap_Time=round((time.time() - Last), 2)
# Total time elapsed from start of timer
Total_Time=round((time.time() - Start), 2)
print("Lap No. "+str(Lap_No))
print("Total Time Elapsed: "+str(Total_Time))
print("Lap Time: "+str(Lap_Time))
print("*"*20)
# Updating the previous total time
# and lap number
Last=time.time()
Lap_No+=1
except KeyboardInterrupt:
print("Stopping Counting Laps")