Lists + Functions


Lists + Functions

Oops, try again. fizz_count(['buzz', 'fizz', 8, 'fizz', 'buzz', 'fizz', 1]) returned 1 instead of the correct answer: 3

Replace this line with your code. Do not remove the backticks that are above or below this line.
def fizz_count(x):
    count= 0
    for item in x:
        if item == "fizz":
            count = count + 1
            return count


You want to return count after the loop.

Otherwise, it would not return anything if something wasn't found, or it would return one if something was found.

Once a function returns, it stops executing.


Cheers and thank for helping


You're welcome! :slightly_smiling: