x= [‘fizz’,‘fizz’,‘fizz’]
small = fizz_count(x)
print small # Write your function below!
def fizz_count(x):
count = 0
for item in x:
if item == “fizz”:
count = count + 1
return count

Why this code is giving 1 as output ?


By default, a function returns None at the end of the function. If we want to return something else at the end of the function, we can use the return keyword.

Given return is the last thing a function does, when a return keyword is reached, the function ends

With this new insight about return, what do you think the problem might be?