Purify - error[1]


#1




hello am having trouble with the purify exercise.. anytime i run the code below, i get this error

Oops, try again. Your function crashed on [1] as input because your function throws a "'int' object is not iterable" error.

but it works well on an online IDE i use.

def purify(lip):
    p=0
    #lit=str(lip)  
    if lip==[1]:
        return 0
        
        
        
    else:
        for i in lip:
             if i%2 != 0:
                continue
                p=i+p
            
    return p


#2

if lip==[1]:
        return 0

here, you should return an empty list. The validation excepts an empty list to be returned, not a integer, that is why you get the error


#3

henestly... i really do not understand you, can you plz explain more


#4

if you purify [1] you should get [], not 0


#5

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