```
I have written this code and it works perfectly fine in the Python IDLE
but it's not working in the codecademy's editor.
def purify(lst):
for i in range(1,len(lst)+1):
if i%2==0:
new_list.append(i)
return new_list
```

# Purify

**comrade49**#1

**rcodeman**#2

Did you call your function?

have a look at this line

`new_list.append(i)`

where does the `new_list`

come from?

**comrade49**#3

new_list=[]

its an empty list which i forgot to mention and yeah i called that function but i didnt pass the codecademy test

**rcodeman**#4

now see

`for i in range(1,len(lst)+1):`

here what is `i`

? It’s looping from `1`

to the length of the `lst`

.

but it should be loop through the values of the `lst`

.then you can check whether or not the number (`i`

in the loop) is divided by two has a remainder of `0`

.

def purify(numbers):

new_numbers = [] # to add something to an empty list you shoud declare it first…

for i in numbers: # when u specify range you are checking numbers from 1 to a length of input list

if i % 2 == 0:

new_numbers.append(i)

return new_numbers

this is my example

**system**#6

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