Purify


#1



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

Oops, try again. Your function fails on purify([4, 5, 5, 4]). It returns [4, 5, 4] when it should return [4, 4].


ope is correct


def purify(number):
    
    for i in number: 
        if i % 2 != 0:
            number.remove(i)
    return number


#2

The .remove() only removes the first item. For this lesson, you will be better to make an empty list, then append to that list any even number.

https://docs.python.org/2/tutorial/datastructures.html


#3

please i dnt get u well


#4

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