12. Purify


#1

Oops, try again. Your code looks a bit off--it threw a "'str' object has no attribute 'append'" error. Check the Hint if you need help!

Can someone help me?


def purify(numbers):
    new=""
    for i in numbers:
        if i%2==0:
            new.append(i)
    return new


#2

you declared new as a string:

new=""

this should be a list. append() is a function which appends item to a list


#3

Hi,
Your new variable needs to be a list:
new = []


#4

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