A day at the supermarket 4


#1

Code:

# Write your function below!
def fizz_count(x):
    count = 0 
for fizz in x:
    if fizz == "fizz":
        count += 1
        return count

Error:
File "python", line 7
SyntaxError: 'return' outside function

What's wrong?


#2

Indentation issues, it would seem.


#4

def fizz_count(x):
count = 0

for item in x:
    if item == "fizz":
        count += 1

return count

Your spacing is off. Return is placed wrongly.


#7