When the following statement is run, the data type of the elements of this numpy array is..
import numpy as np
np.array(['ab', False])

Error as it has mixed type Both String and Boolean String Boolean False is converted to a String and all the elements are Strings

Study the given numpy array. The size of the array found by using 'size' function is:
np.array([[1, 2], [3, 4], [5, 6]])

6 (3, 2) (2, 3) Size is the total number of elements in the array

Study the given numpy array. The number of dimensions count found by using 'ndim' of the array is:
np.array([[1, 2], [3, 4], [5, 6]])

2 3 6 This is an array of two dimensions as it has rows and columns

Study the given numpy array. The shape of the array using the 'shape' function is:
np.array([[1, 2], [3, 4], [5, 6]])

6 (3, 2) (2, 3) Shape is row count, column count in this 2 dimensional array

Exercise

More Exercises: https://www.w3resource.com/python-exercises/numpy/basic/index.php

results matching ""

    No results matching ""