Skip to content

Commit 4e70db7

Browse files
Add files via upload
1 parent 0c07ec9 commit 4e70db7

File tree

1 file changed

+15
-0
lines changed
  • Countdown Timer using Python

1 file changed

+15
-0
lines changed

Countdown Timer using Python/main.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import time
2+
3+
def countdown(t):
4+
while t:
5+
mins, secs = divmod(t, 60)
6+
timer = '{:02d}:{:02d}'.format(mins,secs)
7+
print(timer, end="\r")
8+
time.sleep(1)
9+
t -= 1
10+
11+
print('Timer completed!')
12+
13+
t = input('Enter the time in seconds: ')
14+
15+
countdown(int(t))

0 commit comments

Comments
 (0)