List + Functions


def fizz_count(X):
    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


when you defined your function:

def fizz_count(X)

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


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