Introduction
In Python, a countdown timer is a program that counts down from a given time to zero. The user receives a signal when the countdown is complete, and it typically refreshes the remaining time every second.
Source Code:
import time
def countdown(ti):
while ti:
mins, secs = divmod(ti, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r")
time.sleep(1)
ti -= 1
print("Time's up!")
ti = input("Enter the time in seconds: ")
countdown(int(ti))