someone could explain it? why the output in code playground is one and in IDLE is another? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

someone could explain it? why the output in code playground is one and in IDLE is another?

https://code.sololearn.com/cj6hY3Cw8dpb/?ref=app

13th Aug 2017, 3:06 AM
Guilherme Ferreira Carvalho
Guilherme Ferreira Carvalho - avatar
2 Answers
0
That is about low-level stuff. In code playground your code is sent do sololearn's servers to run there and sends you results. The difference is between versions- one on sl's servers and another on your computer. This is problem with how python handles arrays. In version you are using on your computer array store pointers to objects that shoud be there and so if the object is changed all same objects change (to solve that you need to create new array into each index of array: a = [] for _ in range(4): a.append([]) # a is now [ [], [], [], [] ] a[2] = 1 # a is now [ [], [], 1, [] ] ) The version on sl's servers seems to handle it differently...
13th Aug 2017, 3:15 AM
Michal Pácal
Michal Pácal - avatar
0
thanks for the explanation, i thought that all the versions were up to date like in the computer i tested. btw, i ve done a code to write 3 dimensional arrays following this route https://code.sololearn.com/cnjw18qZJeAF/?ref=app
13th Aug 2017, 4:39 AM
Guilherme Ferreira Carvalho
Guilherme Ferreira Carvalho - avatar