Python Practice › NumPy Programs › Program 80

Product of an array

EasyNumPy Programs · 80 of 100

Write a NumPy program to calculate the product of an array.

Advertisement
Input
[3, 5, 1]
Output
15

Approach

  1. np.prod.

Solution

Python
import numpy as npprint(np.prod([3, 5, 1]))
Output
15

Learn the concept

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

More numpy programs

← All 100 NumPy Programs

Leave a Comment