Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # define a function that multiply all the numbers in a list
- # multiply_list()
- def multiply_list(number):
- total = 1
- for x in number:
- total *= x
- return total
- # initialize a list that contains a number element
- num_list = (5, 4, 3, 2, 1)
- # print the list num_list
- print("The list of numbers is: ", num_list)
- # call function multiply_list() to get the product of the numbers in list
- print("The product is: ", multiply_list(num_list)) # this will print the product of the numbers in list num_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement