4/13 Lists + Functions


#1

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.


#2

move your return line outside the for loop


#3

That doesn't work either.


#4

@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


#5

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.


#6

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