py countdown

Solutions on MaxInterview for py countdown by the best coders in the world

showing results for - "py countdown"
Fabio
13 Nov 2019
1# import the time module 
2import time 
3
4# define the countdown func. 
5def countdown(t): 
6	
7	while t: 
8		mins, secs = divmod(t, 60) 
9		timer = '{:02d}:{:02d}'.format(mins, secs) 
10		print(timer, end="\r") 
11		time.sleep(1) 
12		t -= 1
13	
14	print('Fire in the hole!!') 
15
16
17# put time in seconds here
18t = 10
19
20# function call 
21countdown(int(t)) 
22