0
Arr = np.array ([[1,2,3,4,5],[6,7,8,9,10]])
Help solve
3 Respostas
+ 5
You did not ask any questions, so far you have declared a numpy array.
What do you need help with?
+ 1
Which code outputs 9
Arr[2,4]
Arr[1,3]
Arr[9]
+ 1
Arr is a multidimensional array. Specifically it has two dimensions, because there are two levels of nesting. So to arrive at one specific value, you have to provide two indices (index values). First number is which sublist, then which element in that sublist. Because the index starts counting with 0, the answer is that Arr[1,3] represents the value 9 because it is the 4th value in the second sublist. And this syntax for the indexing, is only specific to numpy arrays. In a regular python list, you have only a single dimension, and you cannot use indexing separated by comma.