Help at day at the supermarket pleeeease!


#1



# Write your function below!
def fizz_count(x):
    count = 0
    for x in x:
        if x == "fizz":
            count = count + 1
        return count
fizz_count = ["dummy", "fizz", "blank"]


#2

Your indentation looks a bit off.


#3

how so? please tell me


#4

You've edited the OP, after the fact.


#5

yes, i believe i fixxed it. im getting an error saying "Oops, try again. fizz_buzz doesn't look like it is a function!"


#6

Is the function supposed to be called fizz_buzz or fizz_count?


#7

fizz count

[this text is here for the purpose of being over 20 characters and thus a valid reply]


#8

Is your return statement still inside the loop, or did you move it left?


#9

here is what i currently have:

# Write your function below!
def fizz_count(x):
    count = 0
    for x in x:
        if x == "fizz":
            count = count + 1
        return count
fizz_count = ["dummy", "fizz", "blank"]

#10

After formatting, we can see that return is inside the loop. It should line up with for.

That is not the only problem, though.

Huh?


#12

what should it look like


#13
for *anything* in x:

anything but x itself.

for n in x:

x is the data structure, n is the data member.


#14

got it. thanks! [more filler characters]


#15

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