How to make a countdown timer in Python with Source code | Code with Mudassir

preview_player
Показать описание
How to make a countdown timer in Python with Source code | Code with Mudassir

#Shorts
#Python_code
#Source_code

Check the code:
#Python countdown timer
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_sec -= 1

print("Timer Ended!")

countdown(5)

Please comment Like Share and Subscribe our channel for more video
Рекомендации по теме
Комментарии
Автор

In the current versions of python you can just format the code by adding f to the stsrt of the string ( f"{var:0.00}" )

pretro
Автор

Thanks, but countdown does not appear in the printout. Only after 5 seconds Timer Ended appears

media
Автор

Can you please tell me what application were you using to execute the program??? Codeblock??

fardinshahriare
Автор

how can i add the parts of seconds (second/60)?pls

Python
Автор

How would I make it read hours and days?

RoyaltyVR
Автор

how can i make this like, "in (timer) seconds the program will close"?

kndzz