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)) :(

2nd May 2021, 9:11 AM
Dharchini Priya P
Dharchini Priya P - avatar
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.
2nd May 2021, 10:02 AM
Abhishek Tandon
Abhishek Tandon - avatar
+ 3
sleep() won't work on sololearn. Is that your problem?
2nd May 2021, 9:35 AM
Abhishek Tandon
Abhishek Tandon - avatar
+ 2
check condition of while loop
2nd May 2021, 9:27 AM
Aman Jain
Aman Jain - avatar
+ 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
2nd May 2021, 9:36 AM
Aman Jain
Aman Jain - avatar
+ 1
I don't get that
2nd May 2021, 9:28 AM
Dharchini Priya P
Dharchini Priya P - avatar
+ 1
Aman Jain there is no difference in the previous output and the output produced by your code
2nd May 2021, 9:37 AM
Abhishek Tandon
Abhishek Tandon - avatar
+ 1
If my input is <=5 I'm getting the o/p But when my input is >5 I'm not getting o/p
2nd May 2021, 9:58 AM
Dharchini Priya P
Dharchini Priya P - avatar
+ 1
Tans pal... 🎊 it's working... I got the o/p 😉
2nd May 2021, 10:11 AM
Dharchini Priya P
Dharchini Priya P - avatar