Array to list
Write a NumPy program to convert an array into a list.
[[3, 0], [6, 4]]
[[3, 0], [6, 4]]
Approach
.tolist()gives plain Python ints.
Solution
import numpy as npprint(np.array([[3, 0], [6, 4]]).tolist())[[3, 0], [6, 4]]
Learn the concept
New to this topic? Read the lesson, then come back.