Countdown Timer – Mini Python Project Pythongdb

Countdown timer is made using the python time module which is terminal view to countdown the time

Python Code for Countdown Timer

//countdown timer
import time

def countdown(t):
    while t:
        mins, secs = divmod(t, 60)
        timer = '{:02d}:{:02d}'.format(mins,secs)
        print(timer, end="\r")
        t -= 1

    print('Timer completed!')

t = input('Enter the time in seconds: ')


Screenshot Showing the Output in terminal from the above run program.

Enter the time in second example:- 30 it will show like 00:30 Timer completed!.

output of countdown timer

Leave a Comment