This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Natasha Arora
almost 10 years

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

Answer 5361394b7c82ca027d0000a3

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
points
Submitted by Siddharth Mishra
almost 10 years

4 comments

Natasha Arora almost 10 years

thanks a lot!

Siddharth Mishra almost 10 years

You’re welcome

Noëmie Heinen almost 10 years

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

B Liyanage Asanka almost 10 years

Hey mishra how do you put indent in your comment

Answer 5379ed89631fe9d1be00639b

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
points
Submitted by B Liyanage Asanka
almost 10 years

3 comments

Siddharth Mishra almost 10 years

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

B Liyanage Asanka almost 10 years

oh Thank you bro.I get it.

Siddharth Mishra almost 10 years

you’re welcome