Answers for "python program to multiply all items in list"

1

python program to multiplies all the items in a list using function

def list_number_multiplier(list_of_numbers):
    result = 1
    for item in list_of_numbers:
        result = result * item
    return result
x = [2,5,8]
print(list_number_multiplier(x))
Posted by: Guest on July-27-2021
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

Code answers related to "python program to multiply all items in list"

Python Answers by Framework

Browse Popular Code Answers by Language