This forum is now read-only. Please use our new forums at discuss.codecademy.com.

233 points
Picture
Submitted by
Natasha Arora
almost 5 years ago

12/15. What is wrong?Please help ASAP.

def purify(lst):
even=[]
for num in lst:
if num%2==0 :
even.append(num)
return even


5 votes

permalink

Hello again Natasha. Your code looks perfect to me. Maybe you got your indentation wrong.
Your code with correct indentation ----

def purify(lst):
    even=[]
    for num in lst:
        if num%2==0 :
            even.append(num)
    return even

954 points
5363477080ff336807000f0d_716015841
Submitted by
Siddharth Mishra
almost 5 years ago

4 Comments

Picture Natasha Arora almost 5 years ago

thanks a lot!

5363477080ff336807000f0d_716015841 Siddharth Mishra almost 5 years ago

You're welcome

Picture Noƫmie Heinen almost 5 years ago

just wondering why you instead of even.append(num) you can't have even +=num. Thank you!

583af449e92d416e9a0001a2_142199093 B Liyanage Asanka almost 5 years ago

Hey mishra how do you put indent in your comment


0 votes

permalink

My code output is correct in python IDE but code editor doesn't let me go ahead.

def purify(lst):
for odd in lst:
if odd % 2 == 1:
lst.remove(odd)

return lst

1221 points
583af449e92d416e9a0001a2_142199093
Submitted by
B Liyanage Asanka
almost 5 years ago

3 Comments

5363477080ff336807000f0d_716015841 Siddharth Mishra almost 5 years ago

First Select your whole code , then go for code sample option and Remember - Always keep some empty space between the code you are selecting.

583af449e92d416e9a0001a2_142199093 B Liyanage Asanka almost 5 years ago

oh Thank you bro.I get it.

5363477080ff336807000f0d_716015841 Siddharth Mishra almost 5 years ago

you're welcome