Python Practice › NumPy Programs › Program 99
Tuple to array
Write a NumPy program to convert a tuple into an array.
Input
(5, 7, 0)
Output
[5 7 0]
Approach
np.array(tuple).
Solution
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.