-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.py
More file actions
35 lines (30 loc) · 909 Bytes
/
Copy pathtimer.py
File metadata and controls
35 lines (30 loc) · 909 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 datetime
def Delay():
t1 = datetime.datetime.now()
while True:
t2 = datetime.datetime.now()
if t2.second != t1.second:
break
def Timer():
try:
seconds=input("Please Set Timer(hour:minute:second exp=> 0:28:17)=> ")
seconds = seconds.split(":")
second = int(seconds[2])
minute = int(seconds[1])
hour = int(seconds[0])
except:
print("Error!")
Timer()
return
if (second >=60 or second < 0) or (minute >=60 or minute < 0) or (hour >=24 or hour < 0) :
print("Error!")
Timer()
return
for h in range(hour,-1,-1):
for m in range(minute,-1,-1):
for s in range(second,-1,-1):
print("\rRemaining Time=> {:02}:{:02}:{:02}".format(h,m,s),end="")
Delay()
second = 59
print("\nIt's Done.")
Timer()