Lists + Functions


Lists + Functions

I get this one at the bottom of the screen: Oops, try again. fizz_count(['fizz', 'buzz']) returned 0 instead of the correct answer: 1
and none in the console

i guessed it was because i needed to use the mentioned list instead of x, so i began to change stuff. I tried everything and nothing seems to work.

def fizz_count(x):
    count = 0
    for e in x:
        if e == "fizz":
            count + 1
            return count

I used a million codes and it still doesn't work, i even changed my browser. Please help.


Be sure the return statement is not inside a loop.


You were right about that, but i changed the indentation
i checked with the arrow that it wasn't inside of it and still got the same error


This needs to be reassigned to the variable.


I was searching that stupid mistake for 3 consecutive days.
I LOVE YOU :heart:


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