From 95bd387ae0bda93c6a34c8784cf69c5e18ab1df8 Mon Sep 17 00:00:00 2001 From: Anjali Saxena <67070416+anjali1969@users.noreply.github.com> Date: Fri, 1 Oct 2021 13:22:16 +0530 Subject: [PATCH] Create countUpTime.py --- countUpTime.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 countUpTime.py diff --git a/countUpTime.py b/countUpTime.py new file mode 100644 index 0000000..7fcf2c7 --- /dev/null +++ b/countUpTime.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)