-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimer.py
More file actions
35 lines (32 loc) · 899 Bytes
/
Copy pathTimer.py
File metadata and controls
35 lines (32 loc) · 899 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
35
import time, sys, beepy
print("----------Timer----------")
s = int(input("How many seconds: "))
m = int(input("How many minutes: "))
h = int(input("How many hours: "))
sys.stdout.write(f"\r{h}:{m}:{s}")
time.sleep(1)
sys.stdout.write("\r ")
while True:
if h > 0 or m > 0 or s > 0:
if s > 0:
s -= 1
sys.stdout.write(f"\r{h}:{m}:{s}")
time.sleep(1)
sys.stdout.write("\r ")
elif m > 0:
m -= 1
s = 59
sys.stdout.write(f"\r{h}:{m}:{s}")
time.sleep(1)
sys.stdout.write("\r ")
else:
h -= 1
m = 59
s = 59
sys.stdout.write(f"\r{h}:{m}:{s}")
time.sleep(1)
sys.stdout.write("\r ")
else:
print("\rFinished")
beepy.beep(6)
break