Error 0 instead showed Correct Answer : 1


Hi all

I request your kind assistance to validate the following code, which tells me that shows 0 instead of correct judgment 1. That is what is wrong with the code? I have not been able to find the solution.

def contar_burbujas(x):
    count = 0
    for item in x:
        print "i get executed"
        if item == 'fizz':
            count = count + 1
        return count
print contar_burbujas(['fizz','fIzz'])

Thank you very much.


Hint: return count should only execute after the for loop has completed (put that statement outside the loop).


Thank you, very much!. it worked!