Python Practice › NumPy Programs › Program 99

Tuple to array

EasyNumPy Programs · 99 of 100

Write a NumPy program to convert a tuple into an array.

Advertisement
Input
(5, 7, 0)
Output
[5 7 0]

Approach

  1. np.array(tuple).

Solution

Python
import numpy as npprint(np.array((5, 7, 0)))
Output
[5 7 0]

Learn the concept

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

More numpy programs

← All 100 NumPy Programs

Leave a Comment