A Day at the Supermarket 4/13 (Lists + Functions)


#1

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

fizz_count(["fizz","cat","fizz"])

Hi this is my code and it keeps on coming up with this error...

I would be very grateful if you could assist me in this matter as I am a beginner in coding
Many thanks in advance!


#2

We can't tell for sure because the code sample is not posted so it can be read. However, this error usually indicates the wrong indentation on the return statement.

There should only be one four-space indent on that line so that it lines up with the for statement.


#3

Ok I will give that a go.
Thanks