28
Question Write a Python function to multiply all the numbers in a list.
Sample List: (8, 2, 3, -1, 7)
Expected Output : -336
def multiply_list(numbers):
product = 1
for num in numbers:
product *= num
return product
numbers = eval(input("Enter the list: "))
product = multiply_list(numbers)
print("The product of the numbers in the list is", product)Enter the list: [8, 2, 3, -1, 7]
The product of the numbers in the list is -336
Enter the list: [1, 6, 3, 5]
The product of the numbers in the list is 90