13.product


#1



whats wrong with my code?
def product(i):
    f = 0
    for e in i:
        f.append(e)
        f.append(*)
    return f


#2

your code is creating a list with the elements in i witn an * in between them.

You are supposed to multiply all the elements.

for example

x=[1,2,3,4,5,6]

you should get

mult= 1*2*3*4*5*6
mult=720

try making your code to multiply each element in the list


#3

Hi, texcoder38436 explained why.
But here is the actual code if you are stuck:

def product(lista):
    total = 1
    for item in lista:
        total *= int(item)
    return total

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.