Purify


#1



secuence=[1,2,3]
pares=[]
def purify(secuence):
for i in secuence:
if i%2 == 0 :
pares.append(i)
return pares

print purify(secuence)


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

I dont understand

Replace this line with your code.


#2

this line:

pares=[]

should be inside the function, if not, calling the function multiply times will cause pares to acculamate all even numbers from all the function calls


#3

thanks for your reply, its ok


#4

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