LIst+Fonctions


#1

test = ["fizz","cat","dog","fizz"]

def fizz_count(test):
count = 0

for "fizz" in test :
    if test == "fizz":
         count = count+1
return count

can anyone please tell me what is wrong with my code??????/


#2

for "fizz" in test :
    if test == "fizz":

should be

for fizz in test :
    if fizz == "fizz":

#3

i've allready done that but it shows


but it shows this error


#4

okay you have an indenetation error. starting from the for loop block line indent indent every line 4 spaces(or tab) to the right


#5

write your code exactly as it is demonstrated in the example to you left.
step1:define a function
def fizz_count(argument):
ste2: assign 0 to count
count = 0
step3: use the for loop.
for n in argument:
if n == "fizz":
step4: increment count by one
count = count + 1
print count

step5. do the bottom part of the example using the variables or arguments u used in the first part.