Purify error in my code


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/2?curriculum_id=4f89dab3d788890003000096


I am getting
Oops, try again. 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.


what is wrong in my code?


def purify(numbers):
    list_even = []
    for data in numbers:
        if data % 2 == 0:
           list_even.append[data]
    return list_even


#2

.append() is a method call, calling methods and function requires parentheses

square brackets is for accessing string and list by index and dictionary by key


#3

Thanks, it's working :slight_smile:


#4