Lists + Functions


keeps saying
Oops, try again. fizz_count(['fizz', 'buzz']) returned 0 instead of the correct answer: 1
whats wrong please help

# Write your function below!
def fizz_count(x):
    count = 0
    for item in x:
        if x == "fizz":
            count +=1
    return count
lists = fizz_count(x)
print lists


Could you please provide a link?

Perhaps I'm just blind, but I can't find this exercise, though I do recall doing it.


you can see that it is day in the supermarket of the python track, and then the exercise is called list and function, so you find it? here is the url:

@textblaster00648, this line:

if x == "fizz":

x is the list with items, this can never equal a string. which variable contains the items of the list? (look at the loop)


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