Lists + Functions


#1



https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/0/4?curriculum_id=4f89dab3d788890003000096#


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


My code matches the master exactly and still receiving same error.


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


#2

nevermind. I figured it out. i was using x in my "if" statement instead of item...


#3

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