[Tutor] product of all arguments passed to function call

boB Stepp robertvstepp at gmail.com
Mon May 31 23:08:28 EDT 2021


On Mon, May 31, 2021 at 4:57 AM Manprit Singh <manpritsinghece at gmail.com> wrote:
>
> Dear sir ,
> Consider a problem where i have to find the product of all arguments passed
> to function call , where the function must be capable of accepting any
> number of arguments : My approach will be as follows :
>
> def product(x, *y):
>     for ele in y:
>         x *= ele
>     return x

I would omit "x" from the parameter list and just do "def product(*y):".

boB Stepp


More information about the Tutor mailing list