In this problem, you should write one function named multiply
.
This function should accept one parameter, which you can assume will be a list with one or more integers in it.
(If you don’t know what I mean when I say “list of integers”, go do the reading!)
The function should loop through all of the numbers in the list, and multiply all of the numbers together.
It should return the resulting number.
For instance, if the parameter was the list [2, 3, 5, 2]
, the function should return (2 x 3 x 5 x 2) = (6 x 5 x 2) = (30 x 2) = 60.
A few examples of arguments and return values are shown below:
multiply([20, 4, 3, 7])
should return 1680
multiply([1, 2, 3, 4, 5, 6, 7])
should return 5040
multiply([4, 5, 4, 5, 7, 0, 1, 2, 3])
should return 0
(note the 0 in the argument list)Make sure to include only the one function in your file.
The gradescope tests will call the functions to test them.
Name the program prep17.py
.
Make sure that gradescope gives you the points for passing the test case.