12. pufiry


#1
My code

def purify(lst_1):
    new_lst = []
    for elements in lst_1:
        if elements % 2 == 0:
            new_lst.append[elements]
    return new_lst

Error:
Does your purify function take exactly one argument (a list of numbers)? Your code threw a "'builtin_function_or_method' object has no attribute '__getitem__'" error.


#2

.append() is a method call, it requires parentheses.

square brackets are for retrieving items from list (index) or dictionary (key)

Note: i use method call, then i realized classes haven't been covered yet, so read function call if it confuses you, my mistake


#5