Answer the question
In order to leave comments, you need to log in
[[+content_image]]
Why are the elements connected?
Childish question for pythonists.
When creating a two-dimensional list like this:
matrix = [[0] * 10] *10;
matrix[1][1] = 100;
print matrix;
Answer the question
In order to leave comments, you need to log in
Yes, you could even say, in a sense, that everything in Python is passed by reference. But data types are divided into mutable and immutable. Lists are mutable, but numbers are not.
Arrays can be specified using a special syntax - list comprehensions:matrix = [[0]*10 for x in range(10)]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question