Functions + Lists


#1

So i've browsed soo many questions but still cant find an answer to my question.

Well when I input this code:

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

It gives me this error message:

Oops, try again. fizz_count(['fizz', 'buzz']) returned 0 instead of the correct answer: 1

Please Help me fast


#2

Here:

You want to know if n in **x*** is == 'fizz' and not count.

Hope this helps! :wink:


#3

OMG thanks soo much i cant believe myself for being sooo stupid. You saved me alot of time.:heart:


#4

You're welcome.

Have fun coding! :slight_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.