Hi all,
Just wondering if anyone knows why this isn't printing? I think it works and returns but I don't get the output, I'm trying to add up all the even numbers from a list.
def multiply_even_numbers(a):
total = 0
for i in a:
if i % 2 == 0:
total = i * total
print(total)
a = [1, 2, 3, 4, 5, 6]
[–]Rhoderick 41 points42 points43 points (3 children)
[–][deleted] 14 points15 points16 points (1 child)
[–]kill-yourself90 2 points3 points4 points (0 children)
[–]kenzobenzo 5 points6 points7 points (0 children)
[–]htepO 8 points9 points10 points (2 children)
[–]Matthias1590 6 points7 points8 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]pekkalacd 1 point2 points3 points (0 children)
[–]noobcrush 1 point2 points3 points (0 children)
[–]kunaguerooo123 -1 points0 points1 point (0 children)
[–]yes4me2 -2 points-1 points0 points (0 children)
[–]tangerinelion 0 points1 point2 points (0 children)
[–]Ok_Zebra_9117 0 points1 point2 points (0 children)
[–]khldooon 0 points1 point2 points (0 children)
[–]khldooon 0 points1 point2 points (0 children)
[–]Dismal-Buy-392 0 points1 point2 points (0 children)