Answers for "Write a Python program to multiply all the items in a list"

0

python multiply all elements in list

import numpy as np

list1 = [1,2,3,4,5]
result = np.prod(list1)

print(result)
>>>120
Posted by: Guest on November-14-2020
-2

write a python program to multiplies all the items in a list.

l = [1,2,3,4,5]

tot = 1
for x in l:
  tot = tot * x
  
print(tot)
>>> 120
Posted by: Guest on June-10-2021

Code answers related to "Write a Python program to multiply all the items in a list"

Python Answers by Framework

Browse Popular Code Answers by Language