A day at the supermarket


#1

Write your function below!

def fizz_count(x):
count = 0
for item in x:
if item >= "fizz":
count = count + 1
return count
Oops, try again. fizz_count(['fizz', 'fuzz', 'fizz', 'buzz', 'fIzZ', 'fizz']) returned 4 instead of the correct answer:


#2

could you explain why you choice this:

if item >= "fizz":

for your if condition?


#3

in the step it said make item equal to "fizz"


#4

but >= doesn't mean equal, >= means greater or equal to.


#5

or did I miss something because I cant figure it out


#6

but when I put the = it said that its wrong


#7

a single equal sign means assign, not check if is equal.

check the MDN doc on comparison operators:


#8

oh yeah I forgot about that sorry


#9

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