List + Functions


#1

def fizz_count(X):
    count=0
    for item in x:
        if item =='fizz':
            count = count+1
    return count

Oops, try again. an exception was raised for fizz_count(['fizz', 'buzz']): global name 'x' is not defined

what's wrong with my code


#2

when you defined your function:

def fizz_count(X)

your function parameter (X) is uppercase, and in the for loop it is lowercse


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.