I have a simple for loop which loops through the contents of an int list and multiplies every non zero int. I store this value in the variable mult. However, mult is not changing. What's wrong?
def answer(l):
mult = 0
for i in l:
if i != 0:
if mult == 0:
mult *= i
return mult
print (answer([3,4,5]))
if mult == 0- you'll multiply by zero - is that what you want?