What is the problem ? Please help!


#1


#2

After the return statement there is nothing more to write. So try to delete the commands you wrote underneath your return statement and try to execute your code.


#3

Write your function below!

def fizz_count(x):
count=0
for n in x:

    if n=='fizz':
       count=count+1;
return count

t=['dizz','fizz','fizz','bizzz','fizz'];

numbers=fizz_count(t)
print numbers

Hopefully it can help you!!


#4

Farzfarz is correct (at least in my code). I made the same mistake as you, cssrockstar. On lines 4 and 5, you have:

for x in yigit:
    if x == "fizz":

But 'x' and 'yigit' should be swapped so that the function knows to look within x, not within yigit. Your code on lines 4 and 5 should look like this:

for yigit in x:
    if yigit == "fizz":

Like I said, I did the same thing until I came to this thread and found farzfarz's response, so thanks farzfarz!


#5

My pleasure rmbyrne :smile: