3 ms·
In programmer terms, imagine you had to define the product function in Python. The most natural way to write it is: >>> def product(ints): ... result
by EnPissant 1y ago
In programmer terms, imagine you had to define the product function in Python. The most natural way to write it is:
>>> def product(ints):
... result = 1
... for int in ints:
... result *= int
... return result
In which case there is no need to make 1 a prime as you already have:
>>> product([])
1