forked from Jeanouflage/Flock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlock.py
46 lines (34 loc) · 1.06 KB
/
Flock.py
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
35
36
37
38
39
40
41
42
43
44
45
46
# Flock - The Python Clock App
# https://github.com/Jeanouflage/Flock
from time import sleep
print("""
---
Flock - The Clock App
---
""")
elapsed = 0
modeSelection = False
stopwatch = False
while modeSelection == False:
print("Modes:")
print("1. Stopwatch\n")
modeOption = input("Choose what mode you want to use corresponding to its number: ")
# This only works in Python 3.10 or above, but in my opinion, it is more efficient
match modeOption:
case "1":
modeSelection = True
stopwatch = True
case default:
print("\nUse the number in front of the modes to choose the modes.\n")
if stopwatch:
print("\n\n\n")
while stopwatch:
secs = format((elapsed % 60), '02d')
mins = format((elapsed // 60) % 60, '02d')
hrs = format((elapsed // 3600) % 24, '02d')
days = format((elapsed // 3600 // 24), '02d')
parsedTime = [days, hrs, mins, secs]
if days == "00": parsedTime.remove(days)
print(f"Time Elapsed: {':'.join(parsedTime)}")
elapsed += 1
sleep(1)