Python Practice › NumPy Programs › Program 80
Product of an array
Write a NumPy program to calculate the product of an array.
Input
[3, 5, 1]
Output
15
Approach
np.prod.
Solution
import numpy as npprint(np.prod([3, 5, 1]))Output
15
Learn the concept
New to this topic? Read the lesson, then come back.