A Day at the Supermarket: Lists and Functions


Every time I enter my code, it says File "python", line 2
def fizz_count("fizz", "fizz", "fizz"):
SyntaxError: invalid syntax

I don't know what I'm doing wrong.

This is what my code looks like

def fizz_count("fizz", "fizz", "fizz"):
for item in fizz_count:
if item in fizz_count= "fizz":

    return count



your function should have one parameter? A function parameter can't be a string

currently you have 3 parameters, which are all strings


I changed it to this:

def fizz_count(x):
for item in x:
    if item in x == "fizz":
    return count
fizz_count("fizz", "cat", "fizz")

And it says that I put return outside of the function.


this is currently your function + function content:

def fizz_count(x):

the for loop is outside the function


Thank you for helping. I appreciate it.


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