Solution: Practice Some Basic Methods from the NumPy Library
Learn how to use some basic methods from the NumPy library.
We'll cover the following...
The solution to the problem of writing a program that uses some basic methods from the NumPy library is given below.
Solution
Press + to interact
import numpy as npa = np.full(10, 3)print("An array a of size 10:", a)print("Memory size of array in bytes:", a.nbytes)print("Memory size of array's individual element:", a.itemsize)b = np.linspace(0, 90, 10)print("Another array b of size 10 with values ranging from 0 to 90:", b)b = b[::-1]print("Reverse elements of array b:", b)c = a + bprint("After adding both arrays:", c)
Explanation
- Line