How are you supposed to know this (List + Functions)


#1


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

I did manage to to figure it out but in the code you have to print z how are you
supposed to know to do that because it doesn't say to do that in the instructions.
Did I miss something int the previous lessons or did I not read the instructions very
well?
please answer. thanks!


**here is my code**

def fizz_count(x):
    count=0
    for item in x:
        if(item=='fizz'):
            count = count + 1
    return count
myList = ['fizz','buzz']
z=fizz_count(myList)
print z

here are the instructions

Write a function that counts how many times the string "fizz" appears in a list.

Write a function called fizz_count that takes a list x as input.
Create a variable count to hold the ongoing count. Initialize it to zero.
for each item in x:, if that item is equal to the string "fizz" then increment the count variable.
After the loop, please return the count variable.
For example, fizz_count(["fizz","cat","fizz"]) should return 2.


#2

You are not required to print anything in that exercise, but you definitely should test the code you write, calling your code with some test data and then printing the result is one way to do that.