Skip to content

Commit

Permalink
Countdown Timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Girija17 committed Oct 25, 2022
1 parent 367297c commit f60f9be
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Python/Countdown Timer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import time

def countdown(time_sec):
while time_sec:
mins, secs = divmod(time_sec, 60)
timeformat = '{:02d}:{:02d}'.format(mins, secs)
print(timeformat, end='\r')
time.sleep(1)
time_sec -= 1

print("stop")

countdown(5)

0 comments on commit f60f9be

Please sign in to comment.