["SOLVED"]Python no output problem in SoloLearn | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

["SOLVED"]Python no output problem in SoloLearn

If the code has recursion or indirectly infinite while loop the program crashes and says no output. How to solve this!!! https://code.sololearn.com/cz6LSRO0xk7n/?ref=app

11th Aug 2020, 6:50 AM
MSN
MSN - avatar
33 Answers
+ 13
Sololearn provides a limited time(2-4 sec) for your code to execute. Your code is exceeding time limit during the execution of while loop only(it never reaches the breaking condition) thus last line is not getting printed. You can add a print(i) statement inside the loop to find out till where your loop is running.
11th Aug 2020, 7:01 AM
Arsenic
Arsenic - avatar
+ 9
Namit Jain count out the number of zeros in my k code compared with q&a2 which has pip 20.2.1 installed
11th Aug 2020, 8:55 AM
BroFar
BroFar - avatar
+ 7
Why will it crash in such a small calculation? https://code.sololearn.com/cW5kGulFsV2o/?ref=app
11th Aug 2020, 7:11 AM
Namit Jain
Namit Jain - avatar
+ 6
Sebastian Pacurar BroFar Namit Jain Burey I heard that SoloLearn only runs the code for 3-4 seconds. How can I increase this time so that the code runs long enough?
11th Aug 2020, 6:58 AM
MSN
MSN - avatar
+ 6
Can u explain this code pls. https://code.sololearn.com/cWvcL31luuXj/?ref=app It went way over my head. 😔😖😩
11th Aug 2020, 9:03 AM
MSN
MSN - avatar
+ 5
🇧🇩Saadman Nuheen🇧🇩 as far as my knowledge goes you can't increase the time allocated to your code.
11th Aug 2020, 7:03 AM
Arsenic
Arsenic - avatar
+ 5
🇧🇩Saadman Nuheen🇧🇩 I have already told you that you will have to decrease the calculations in order to make the process faster! Like: if you don't know what's the answer of the code you have made then: https://code.sololearn.com/cWvcL31luuXj/?ref=app
11th Aug 2020, 8:17 AM
Namit Jain
Namit Jain - avatar
+ 4
🇧🇩Saadman Nuheen🇧🇩 you cannot increase this time You will have to make out the shortest method to run your code
11th Aug 2020, 7:39 AM
Namit Jain
Namit Jain - avatar
11th Aug 2020, 7:46 AM
MSN
MSN - avatar
+ 3
🇧🇩Saadman Nuheen🇧🇩 because you are dealing with a huge number the execution times out... here one optional way to look at this https://code.sololearn.com/clgJfZ7Sin0n/?ref=app here is k by itself or 1000 ** 10000 https://code.sololearn.com/cPgbas8lUWGt/?ref=app
11th Aug 2020, 8:34 AM
BroFar
BroFar - avatar
+ 3
BroFar pls see your code again! We want f > l Why not use a library! https://code.sololearn.com/cWvcL31luuXj/?ref=app
11th Aug 2020, 8:38 AM
Namit Jain
Namit Jain - avatar
+ 3
Namit Jain the number asking for is beyond the scope here allowable... Think of it as trying to get the full pi and only having so many seconds to get it.
11th Aug 2020, 8:46 AM
BroFar
BroFar - avatar
+ 3
BroFar but my code is able to find exact value of the number! Pls have a look at my code as well
11th Aug 2020, 8:47 AM
Namit Jain
Namit Jain - avatar
+ 3
Namit Jain it doesn't go deep enough and look again https://code.sololearn.com/cq55rfX1BY0D/?ref=app
11th Aug 2020, 8:52 AM
BroFar
BroFar - avatar
+ 3
Try numpy import numpy as np print(np.arange(1,10000000)) print('this will not print')
11th Aug 2020, 9:04 AM
Steven M
Steven M - avatar
+ 3
BroFar I am printing the value of x and not the value of 1000**10000 Ok, if you want then try this x = 10**30 print(x**1000) print(1000**10000) And count the number of zeros You will find equal number of zeros https://code.sololearn.com/c6xyaTln8JSw/?ref=app If still any objections then come to dm and explain me! You are more experienced in py than me
11th Aug 2020, 9:19 AM
Namit Jain
Namit Jain - avatar
+ 3
Namit Jain in your code titled "q/a", you can install pip version 20.2.2, u should install it😉
12th Aug 2020, 9:19 AM
Query
Query - avatar
+ 3
JUNIOR but nothing is impossible 🙃 The answer is 10**30 https://code.sololearn.com/cWvcL31luuXj/?ref=app
12th Aug 2020, 4:08 PM
Namit Jain
Namit Jain - avatar
+ 3
Coder . Your while loop doesn't even run once. Check the expression. while i: And the value of i at first is 0. So the loop doesn't even run once. So the last line is easily printed. Anyways the problem is solved. Happy coding. edit: @coders ans has been deleted.
13th Aug 2020, 5:36 AM
MSN
MSN - avatar
+ 2
won't reach deep enough Namit Jain look at k code above which reached limits and you are trying to find a number beyond those limits
11th Aug 2020, 8:40 AM
BroFar
BroFar - avatar