Skip to content

Commit 42df33d

Browse files
authored
Merge pull request Rishi098#34 from Mownika25/patch-3
Create CountdownTimer.py
2 parents 80ef949 + d2575a7 commit 42df33d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

CountdownTimer.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import time
2+
3+
def countdown(time_sec):
4+
while time_sec:
5+
mins, secs = divmod(time_sec, 60)
6+
timeformat = '{:02d}:{:02d}'.format(mins, secs)
7+
print(timeformat, end='\r')
8+
time.sleep(1)
9+
time_sec -= 1
10+
11+
print("stop")
12+
13+
countdown(5)

0 commit comments

Comments
 (0)