Multiply All
In this challenge, you are asked to create a function named
multiply_all
. This function should take an arbitrary number of arguments and return the product of all these numbers. If no arguments are provided, the function should return 1, as multiplying by 1 leaves any number unchanged, and 1 is the neutral element for multiplication. Your function should be designed to handle a varying number of inputs.The input contains space-separated integers.
The output should be the product of all numbers passed to the function
multiply_all
.Input | Output |
2 3 4 | 24 |
5 6 7 8 9 | 15120 |
10 20 30 | 6000 |
1 2 3 4 5 | 120 |
Note: For the fourth call to the function, no arguments are passed. Therefore, the output is 1.
Constraints
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB