Product


#1


https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/3?curriculum_id=4f89dab3d788890003000096#

Oops, try again. Your function fails on product([1, 2]). It returns 1 when it should return 2.

Super confused and I can't figure it out

def product(lst):
    total = lst[0]
    for n in lst:
        n *= n * len(lst)
    return total   
    
    
    
print product([4, 5, 5])


#2

so currently you get first value of the list:

total = lst[0]

then you have a loop, and then you return total (which contains first value list)

declare a variable called total, give it a value of 1

loop over your list, multiply each value in list with total, and return total


#3

Fixed now. Thank you.


#4