Do we create our own list?


#1



https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/0/4?curriculum_id=4f89dab3d788890003000096


"Oops, try again. fizz_count(['buzz', 6, 'fizz', 9, 'fIzZ', 'fizz']) returned 0 instead of the correct answer: 2"


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


#2

Yes, I believe that to be the case, just as long as your list has at least one 'fizz' so you get a positive outcome. It can be mixed list.

[ 'fizz', 0, 0, 'fizz', 0, 'fizz']

#3

move your return statement outside the for loop. Because calling return in a function will exit the function.if the return call happens to be in a loop then the loop will terminate.
In your case(with the test case provided) when the loop starts the

statement is the first to be executed and thus terminating the method with count of 0


#4

Cool, thanks. I moved my Return statement outside the For loop and it worked.

I actually never created a list, but my count is still accurate, and shows a value of None, it appears.