4 lists + functions


file "python', line 4
if item == 'fizz'

Syntax Error: invalid syntax

Replace this line with your code. 
def fizz_count(x):
      count = 0
      for item in x:
           if item == 'fizz'
           count = count + 1
      return count


at the end of the if condition there should be a colon


You dont really have to use count for this exercise. I used total instead out of habit.And fizz instead of item in this case.

I might be wrong, but according to my attached screenshot It clearly seems that you removed my code from my comment :confounded:

# Write your function below!
def fizz_count(x):
    total = 0
    for fizz in x:
        if fizz == 'fizz'**:** <--- missing colon
          total += 1
    return total

g = ['a','fizz','e','fizz','fizz']

print fizz_count(g)



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