Please help me with my functions syntax i need help


#1

this is my code

x = ['fizz','cat','fizz']
def fizz_count(x):
count = 0
for item in fizz_count:
if item == 'fizz':
count = count + 1

return count

but it returns the error
Oops, try again. an exception was raised for fizz_count(['fizz', 'buzz']): 'function' object is not iterable

any ideas on how to fix it


#2

Which value do you want to loop through? Which value have you written in your code that Python should loop through?


#3

I hope you have figured it out by now, but if you have not, you need to loop though the information that is stored in the parameter of the function. Simply:

for n in x
if n =='fizz'
count = count + 1