4. Lists + Functions. Can't figure it out



My code returns none instead of the correct response zero.

I expect it to return 2

Replace this line with your code. 
# Write your function below!
def fizz_count(x):
    count = 0
    for item in x:
        if item == "fizz":
            count = count + 1
            return count 
fizz_count(["fizz", "cat", "fizz"])


The return statement belongs outside of the loop.

 def fizz_count(x):
    # ...
    return count


which loop? I have several loops


Outside of the for loop, with minimal indentation, as shown above. That is the only loop. btw.


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