The list in the argument is not an integer, but a list of integers; most would say this is quite another thing. The name could be pluralized and make more sense to the reader. Just saying.
We need you to walk us through the logic just so we can gain an even footing before going forward. The naming aside, it’s difficult to discern why a multiplication function would need a conditional, for one. Why would we need subtract
1 from any given value? What steps are you attempting to perform, here?
You do know that when x is 1 and we subtract 1, it becomes zero. The product will end up being zero. Subtraction (from an unknown factor) is never a good thing when multiplication is involved.
Let’s mess with a module and take it up a notch…
>>> from functools import reduce
>>> def product(x):
return reduce(lambda a, b: a * b, x)
Have to ask, did you learn anything from this? Don’t answer, though. The answer is ‘No.’
Somewhere behind all this is the code you need to know so this sort of thing can come about. If you remember this and don’t learn any of the rest, you’ll crash and burn at some point. Like I said in another post earlier today (or yesterday), don’t look for the best, look for all the ways, and keep digging for more.
Why did I say flat out, no? Because nothing has been learned about planning an algorithm. What you are doing above is just that, planning an algorithm so we would never wish to dissuade you of that pursuit. Coach us to what ideas are going though your mind and we can help you seed your garden with those ideas, only fertilized. What I showed above is far from the field we are sowing today. It is for another day, after the harvest of this crop.