9951 explained code solutions for 126 technologies


python-numpyGet product of array elements


import numpy as np 

a = np.array([1,2,3,4])

prod = np.prod(a)ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

.prod(

returns product of elements of specified array

prod

will contain resulting value