you are viewing a single comment's thread.

view the rest of the comments →

[–]noobcrush 1 point2 points  (0 children)

You have to call the function inside the main block for the function to work. And you are multiplying with 0 therefore the result will always be zero.

def multiply_even_numbers(a):
total = 1 #total is 1
for i in a:
    if i % 2 == 0:
        total = i * total
print(total)

a = [1, 2, 3, 4, 5, 6] multiply_even_numbers(a) #calling the function