+ 1
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
8 Respostas
+ 10
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.
+ 9
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.
+ 9
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
+ 6
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
It does work, doesn't it? It just delays the output until the end, instead of in real-time.
+ 3
It doesnt work in python though. It says "no output."
+ 3
It is python which is a language not a framework or gui or anything else. it can be scripted on several graphic user interfaces and use various libraries LuckiGuy / the code which I showed you is in the textarea tags <-
The JavaScript reads the textarea through the sdk ( software development kit ) and outputs the results.
The <textarea> element tag is used to create a multi-line text input control. It's perfect for allowing users to input large amounts of text, such as comments, messages, or code snippets.
</textarea>
+ 1
BroFar but only on the web though not in python, but thanks for explaining.