In this project, we will like to see the countdown timer by using the Python program.
In this project, we would like to see the countdown timer by using the Python program. The code will take input from the user regarding the length of the countdown in seconds. After that, a countdown will begin on the screen in the format 'minutes: seconds'. We will use the time module here.
import time def countdown(t): while t: mins,secs=divmod(t,60) timer='{:2d}:{:02d}'.format(mins,secs) print(timer,end="\r") time.sleep(1) t -=1 print('Fire in the hole!!') t=input("Enter the time in seconds: ") countdown(int(t))
Submitted by Karthik Nagisetty (karthik)
Download packets of source code on Coders Packet
Comments