4/13 Lists + Functions


Write your function below!

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

test = ['fizz','fizz','fizz']
testing = fizz_count(test)
print testing

Okay, I think my indetion was fine, but it doesn't work.


move your return line outside the for loop


That doesn't work either.


@gangware72 it should work. Can you put what you wrote here?

Be sure to select it (after pasting here) then hit ctrl + k or </> in the tools pane


It totally worked. I'm sorry I didn't come back here and edit this post. I messed up a different variable. Thank you though. You are a super present force on this help board. We need you around here.


Thank you :smile: One more backspace for return did the trick!