+ 1
Odd error! (Never seen)
This code runs perfectly on the local machine. But shows an odd error on the Sololearn's code playground. Why this code shows such type of error? https://code.sololearn.com/c4WLVCm78Rzt/?ref=app
4 Réponses
+ 6
Hi, the reason of the issue is that this code generates permutations from the elements of the list. With these number of elements (12) you will generate millions of permutations, and this will crash the programm, and, depending on which OS your device is running, may be also the memory management.
I have reduced the number of elements, so it runs without problems. But I have a question: Why do you create permutations if you never use them?
As nothing is returned from function, the finla print statement outputs "None".
Here is the "reworked" code:
https://code.sololearn.com/cYgyuCcLzFda/?ref=app
+ 3
The line which is creating an error is list(p(lst))
Sololearn uses a playground in backend and sends the code to that particular language's Playground and gets back the output
Like our code compilers, Playgrounds also have built in modules but there are not as we use them in our personal compilers
They have modules and functions defined differently so that they could not pose a threat to Server security and performance and in order to achieve this Some functions and sometimes even the whole modules can be removed at runtime like for example you cannot import tkinter at here because android is not an ideal platform to run tkinter and also a gui window thus created by tkinter cannot be sent back by the server as it had to be rendered on client machine
The main problem in your code is that it uses tooo much memory by creating tooo much permutations
+ 3
Lothar I was working for the shuffler assignment.
Thanks for the answer. 😄😄