Lists + Functions - I don't understand it! :(


#1

Could someone please explain how to write the code and what each line does.


#2

Perhaps you should start by considering what the task is, divide it into steps and then implement those steps one at a time.


#3

still not helping xD


#4

def fizz_count(x):
count = 0
for item in x:
if item == "fizz":
count = count + 1
return count
fizz_count(["fizz","cat","fizz"])
print fizz_count


#5

You have the majority of your code correct the last two lines need to be adjusted.

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

Your invoking the fizz_count function and then trying to print it out to the console. What you would want to do is store the fizz_count function results in a variable and then print to console what is stored in the variable.