Lists + Functions


it says that it returns false not 1

what is wrong

Replace this line with your code. 

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


Function ends on the keyword, return.
Remove the first return and unindent the second return line so that it lines up with the for loop.


2 posts were split to a new topic: Why this isn't a valid reassignment


Oh that's a good point haha. I didn't even notice that, thank you.


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