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
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.