Python Practice › NumPy Programs › Program 44

One-dimensional array

EasyNumPy Programs · 44 of 100

Write a NumPy program to create a one-dimensional array.

Advertisement
Output
[65 90  1  3  5] 1

Approach

  1. np.array with a flat list.

Solution

Python
import numpy as npa = np.array([65, 90, 1, 3, 5])print(a, a.ndim)
Output
[65 90  1  3  5] 1
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More numpy programs

← All 100 NumPy Programs