0
😥Can anyone help me in getting output 😞
I couldn't get output ... I tried to spot the error to rectify but I couldn't 😭 I tried to python program for making countdown TT import time 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('Blast Off!!!') t = input("Enter the time in seconds: ") countdown (int(t)) :(
8 Respuestas
+ 6
Just remove time.sleep(1) and it will work fine. sleep() wastes lots of CPU time and the Sololearn compiler times out. If you really wish you see the sleep effect, run the code on a PC and not on Sololearn.
+ 3
sleep() won't work on sololearn. Is that your problem?
+ 2
check condition of while loop
+ 2
import time
def countdown(t):
while t>0:
mins, secs = divmod(t, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r ")
time.sleep(1)
t-=1
print('Blast Off!!!')
t = input("Enter the time in seconds: ")
countdown (int(t))
OUTPUT :-
Enter the time in seconds: 5
00:05 00:04 00:03 00:02 00:01 Blast Off!!!
May this program will help you
+ 1
I don't get that
+ 1
Aman Jain there is no difference in the previous output and the output produced by your code
+ 1
If my input is <=5 I'm getting the o/p
But when my input is >5 I'm not getting o/p
+ 1
Tans pal... 🎊 it's working...
I got the o/p 😉