4/13 Help I keep getting syntax error!


#1

This is my code will someone help me?
def fizz_count(x):
count = 0
for item in x:
if item == "fizz":
count = count + 1
return count


#2

Hi,

can you format your post by highlighting the code part and then presing the </> button? It will then show the indentation which could cause a syntax error.


#3

in your count statement instead of putting count = count +1
use count += 1 which will automatically add 1 to count

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


#4

Thanks that helped so much. Your awesome :slight_smile: