12. purify


  1. purify

Code works but codecademy does not accept it. Gives error that it fails when it really passes.

I expect it to accept the code...

numbers = []
numbers2 = []

def purify(numbers):
    i = 0
    while i < len(numbers):
        if numbers[i] % 2 == 0:
        i += 1
    print numbers2
    return numbers2



Those are both in global scope. Recommend remove both and define just one list inside the function. The parameter is the other one.

Unless this is for debugging purposes it may be removed as it is not asked for in the instructions.


Thanks for the suggestion.

Right, the print numbers2 was for debugging purposes.

If this worked for you as well I think I should have reported a bug instead of posting to this forum....


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.