Lists + Functions


#1



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.


#2

Be sure the return statement is not inside a loop.


#3

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


#4

This needs to be reassigned to the variable.


#5

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


#7

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