List + Functions


File “python”, line 5
if item = “fizz”:
SyntaxError: invalid syntax

I don’t understand what the problem is!

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


nevermind, i solved it. I just needed to add another =.


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