1. Home
  2. /
  3. Blog
  4. /
  5. Python Program to Create a Countdown Timer
Python

Python Program to Create a Countdown Timer

September 27, 2022 1 min read 2,383
Python Program to Create a Countdown Timer
num = int(input("Enter a number: "))   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)
Share:
Read next

Related articles