# 13/15: Any hints?

#1

I am properly stuck on 13/15 - any hints regarding a working code would be much appreciated!

#2
``````def product(p):
q = 1
for i in range(len(p)):
q = q * p[i]
return q
print(product([4, 5, 5]))``````

#3
``````def product("""list of numbers as in example"""):
"""counter""" = 1 #because multiplying by 0 is 0
# your counter should be multiplied by each element in your list \n and then return the result of this multiplying``````

Hope this helps.

#4

Here is my simple code

``````def product(numbers):
t=1
for i in numbers:
t=t*i
return t``````

#5

Great hint. thanks for not spelling it out directly!

#6
``````def product(numbers):
total = 1  # Total is 1 because anything times zero equals zero
total = int(total) # total has to be an integer
for x in numbers:
total *= x # Here, this means that it multiplies x by the total, and does so for each

#8

Yours works well. I took a different approach on the for loop and did this:

``````def product(list):
pro = 1
for number in list:
pro *= number
return pro``````

#9

Thanks for the comment

#10

Quite elegant solution!

#11

I found and learned what the "reduce" function does and came up with this:

``````def product(int_lst):
return reduce(lambda x,y: x * y, int_lst)``````

#12

Here is my code, it's very simple to understand:
def product(lst):
result=1
for i in lst:
result *= i
return result