List + Functions


#1

https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/0/4?curriculum_id=4f89dab3d788890003000096#

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"])  



#2

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


#3

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