w3resource logo


Python Exercises

Python: Write a Python program to multiplies all the items in a list


Write a Python program to multiplies all the items in a list.

Sample Solution :

Python Code :

def multiply_list(items):
    tot = items[0]
    for x in items:
        tot *= x
    return tot
print(multiply_list([1,2,-8]))

Console :

Copy and paste the above code and press "Enter key" to execute :

Post your code through Disqus