- 2

How to creat a countdown timer?

Can any one tell me how to creat a python based timer that start counting down from 10.

8th Feb 2022, 6:40 PM
Santosh Dhakal
Santosh Dhakal - avatar
1 Antwort
+ 2
import time # define the countdown function def countdown(t): while t: mins, secs = divmod(t, 60) timer = '{:02d}:{:02d}'.format(mins, secs) print(timer, end="\r") time.sleep(1) t -= 1 print('end') # input time in seconds t = input("Enter the time in seconds: ") # function call countdown(int(t))
8th Feb 2022, 8:08 PM
JaScript
JaScript - avatar