Oops, try again. Your function fails on purify(). It returns [2, 4, 6, 8] when it should return .
Hey guys, I managed to fix my code but I don't understand about the positioning when it comes to defining a new list(in my case i used blist).
In the wrong code, I defined blist= above the purify function and I append to blist in the
However in the correct code, blist= was defined after defining purify function. I don't understand whats the difference, could someone help me on this? Thank you!
Wrong Code: blist= def purify(alist): for i in alist: if i % 2 == 0: blist.append(i) return blist Working Code: def purify(alist): blist= for i in alist: if i % 2 == 0: blist.append(i) return blist