A day at the Supermarket (error says my function isn't iterable ...)


#1



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


I'm getting error saying my function isn't iterable ... can you give me a hint ?


def fizz_count(x):
    count = 0
    for x in fizz_count:
        if x == "fizz":
            count = count + 1
                
            return count
            
fizz_count(["fizz", "budgie", "fizz", "car", "boom", "drumstick", "house", "fizz"])


#2

This code worked:

def fizz_count(x):
count = 0
for item in x:
if item == "fizz":
count += 1

return count

fizz_count(["fizz", "budgie", "fizz", "car", "boom", "drumstick", "house", "fizz"])


#3

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