# (4/13) Getting syntax error, unsure of why

#1

This is my input:

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

And this is the error I'm getting back:

File "python", line 5
if item = "fizz":
^
SyntaxError: invalid syntax

Am I just not seeing what's wrong? Can somebody point me in the right direction? Thanks in advance!

#2

Try> if item == "fizz":

Here's the whole function:

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

#3

Wow. That was simple. Haha, I don't know why I didn't think of that earlier.

Thanks much!

#4

Somehow that code doesn't work... I used that code and I got this error message

Oops, try again. fizz_count(['fizz', 'fuzz', 'fizz']) returned 1 instead of the correct answer: 2

When I entered this code:

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

#5

seems like an indentation error

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

also instead of taking count and making it equal itself +1 you can just do

``count += 1``

#6

whoa thanks, this helps me!

#7

def fizz_count(numbers):
count = 0
for n in numbers:
if n =="fizz":
count = count + 1
return count

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

Tell me if it works

#9

Thanks! seems like indentation is really huge in Python

#10

This helps so much! Thanks.

#11