0
pls sololearn fix this
sololearn can you please fix the input system in the code bits. And when I tried to do a countdown in python but, sleep() system is not working. So can you pls fix it
6 ответов
+ 8
You have to give all your input at once in a pop up box, and yes sleep() doesn't work on Sololearn compiler.
Give a suggestion feedback to Sololearn via info@sololearn.com.
+ 8
LuckiGuy / Gulshan Mahawar
sleep() does work just not in the Python playground
Using python skulpt module in web playground it is possible and works.
Example:
https://sololearn.com/compiler-playground/Wjo2ZOjvNjN8/?ref=app
+ 5
LuckiGuy I just explained that it doesn't work in the Python playground but it does work in the Web playground
Look at the textarea where the Python code ( script ) is...
import time
def countdown(seconds):
while seconds > 0:
print(seconds)
time.sleep(seconds)
seconds -= 1
print("Time's up!")
countdown(15)
+ 5
Yes, Ausgrindtube you're right 👍.
LuckiGuy
Actually the sleep() work in python, but the problem is that it execute all the print statements at once.
For example:-
import time
for i in range(5):
time.sleep(1)
print(i)
In the above code,
time.sleep(1) will be execute 5 times.
So, it will output all the numbers after 5 seconds.
Also when you try to use bigger value in sleep() i.e more than 5, it will say 'no output' because there is a time limit or timeout for a code execution .
And use web playground using skulpt as BroFar Sir mentioned for better output.
+ 3
It doesnt work in python though. It says "no output."
+ 3
It does work, doesn't it? It just delays the output until the end, instead of in real-time.