4/13


#1

My code isn't being accepted

def fizz_count(x):
count == 0

for item in x:
if count < 10:
if item == "fizz":
return count

x = ["fizz", "cat", "fizz"]
print fizz_count(x)


#2
def fizz_count(x):
count == 0

for item in x:
if count < 10:
if item == "fizz":
return count

We need for count to accumulate with each found string match:

    for item in x:
        if item == 'fizz': 
            count += 1
    return count

#3

whenever i put that in it keeps saying

"SyntaxError: 'return' outside function"


#4

@corewhiz75279 ,

Because your code is not formatted, it is difficult for other users to read and debug it. After code is been pasted into the editing window for posting, you can format it by selecting it, and then by clicking the </> button above the editing area. This will enable us to see important details, such as the indentation and underscores.

Make sure the code that you submitted to the Python interpreter is indented properly. If your return statement, for example, is not indented, the interpreter will consider it to be outside your fizz_count function.