+ 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

14th Nov 2024, 12:50 AM
LuckiGuy
LuckiGuy - avatar
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.
14th Nov 2024, 9:27 AM
Gulshan Mahawar
Gulshan Mahawar - avatar
+ 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.
14th Nov 2024, 1:16 AM
Gulshan Mahawar
Gulshan Mahawar - avatar
+ 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
14th Nov 2024, 2:06 AM
BroFar
BroFar - avatar
+ 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)
14th Nov 2024, 3:23 AM
BroFar
BroFar - avatar
+ 5
It does work, doesn't it? It just delays the output until the end, instead of in real-time.
14th Nov 2024, 7:43 AM
Ausgrindtube
Ausgrindtube - avatar
+ 3
It doesnt work in python though. It says "no output."
14th Nov 2024, 3:18 AM
LuckiGuy
LuckiGuy - avatar
+ 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>
14th Nov 2024, 11:00 PM
BroFar
BroFar - avatar
+ 1
BroFar but only on the web though not in python, but thanks for explaining.
14th Nov 2024, 10:41 PM
LuckiGuy
LuckiGuy - avatar