Programming Pandit

c/c++/c#/Javav/Python


Latest Update

Monday, November 23, 2020

Python program to multiply all the numbers in a list by G Krishna Chauhan

Source Code


def multiplyList(myList) :

# Multiply elements one by one

result = 1

for x in myList:

result = result * x 

return result 

# Driver code

list1 = [1, 2, 3] 

list2 = [3, 2, 4]

print(multiplyList(list1))

print(multiplyList(list2))



OUTPUT


6
24

No comments:

Post a Comment