Python Practice › NumPy Programs › Program 44
One-dimensional array
Write a NumPy program to create a one-dimensional array.
Output
[65 90 1 3 5] 1
Approach
np.arraywith a flat list.
Solution
import numpy as npa = np.array([65, 90, 1, 3, 5])print(a, a.ndim)Output
[65 90 1 3 5] 1
Learn the concept
New to this topic? Read the lesson, then come back.