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

Solutions on MaxInterview for python program to multiplies all the items in a list using function by the best coders in the world

showing results for - "python program to multiplies all the items in a list using function"
Leah
07 Jan 2020
1def list_number_multiplier(list_of_numbers):
2    result = 1
3    for item in list_of_numbers:
4        result = result * item
5    return result
6x = [2,5,8]
7print(list_number_multiplier(x))
Felix
13 Jul 2018
1l = [1,2,3,4,5]
2
3tot = 1
4for x in l:
5  tot = tot * x
6  
7print(tot)
8>>> 120