diff --git a/Python/countdown.py b/Python/countdown.py new file mode 100644 index 00000000..ab95b738 --- /dev/null +++ b/Python/countdown.py @@ -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) \ No newline at end of file