import numpy as np # Create an array of rank 2 my_arr = np.array([[1,2,3,4], [5,6,7,8]]) print(my_arr) print(my_arr[1, 2]) # a | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

import numpy as np # Create an array of rank 2 my_arr = np.array([[1,2,3,4], [5,6,7,8]]) print(my_arr) print(my_arr[1, 2]) # a

import numpy as np # Create an array of rank 2 my_arr = np.array([[1,2,3,4], [5,6,7,8]]) print(my_arr) print(my_arr[1, 2]) # access a single element print(my_arr.ndim) # the rank print(my_arr.shape) # n rows, m columns print(my_arr.size) # number of elements print(type(my_arr)) # element type

2nd Dec 2022, 4:43 PM
Urkki Saksi
Urkki Saksi - avatar
1 Answer
+ 1
You haven't really included a question. In order to help people help you, it's better if you attach the code by clicking/tapping the add button. And only write what the problem is. Don't forget to tag the language as well.
2nd Dec 2022, 5:06 PM
Ausgrindtube
Ausgrindtube - avatar