This code seems to work for any list of numbers that I pass it yet I still get the error:
Does your purify function take exactly one argument (a list of numbers)?
Your code threw a "unsupported operand type(s) for %: 'list' and 'int'"
Is python treating my variable num as a list?
Thank you for any responses!

def purify(*numbers):
    evens = []
    for num in numbers:
        if num % 2 == 0:
    return evens
print purify(4,6,2,3,4,7,9,2)


num is a number, and numbers is a tuple. The code works as expected. However, since it is not passing a list (1 argument) the SCT is failing the exercise. It probably has a limited number of error messages so we get the message you see. If it makes no sense, we can ignore it, or have it translate to... "You did not follow the instructions."

Pass in a list and your code will be fine. Remove the splat from the parameter.


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