-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime_3.py
More file actions
35 lines (25 loc) · 795 Bytes
/
Copy pathtime_3.py
File metadata and controls
35 lines (25 loc) · 795 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
# return td.days, td.seconds//3600, (td.seconds//60)%60
#hours, remainder = divmod(td.seconds, 3600)
#minutes, seconds = divmod(remainder, 60)
#1 hour = 3,600 secs
#1 min = 60 secs
import time
# define the countdown func.
def countdown(t):
while t:
hrs, remainder = divmod(t, 3600)
mins, secs = divmod(remainder, 60)
timer = '{:02d}:{:02d}:{:02d}'.format(hrs,mins, secs)
print(timer, end="\r")
time.sleep(1)
t -= 1
print('Fire in the hole!!')
# input time in seconds
t = int(input("Enter the time in hours: "))
t2 = int(input("Enter number in mins"))
t3 = int(input("Enter a number in secs"))
t = t * 3600
t2 = t2 * 60
t4 = t + t2 + t3
# function call
countdown(int(t4))