Trouble in "A day at the supermarket"


#1

def fizz_count(x):
count=0
for item in x:
if item=="fizz":
count+=1
return count
a=["fizz","dd","fizz"]
small=fizz_count(a)
print small

my code doesnt run correctly.at the panel it appears the number 1 instead of 2.can u help me?


#2

Hey, please insert your code with indents. Paste your code, select it and press Ctrl + Shift + C or even better place it between three backticks/backquotes before your code and three backticks/backquotes after your code.

Also remove small and try with print fizz_count(a) probably it won't solve your problem but it's shorter way.


#3

check if the "return count" is outside of the for loop.