An issue with Count


My code

def count(item, sequence):

    found = 0

    for i in sequence:
        if i == item:
            found = found + 1
    return found

Throws the error:

Oops, try again. Your function crashed on ([1], 7) as input because your function throws a "'int' object is not iterable" error.


the exercise calls the function, where the first argument is the sequence (the list) and the item the second argument, but your function parameters are the other way around (function declaration on line 1)


This was the problem, thanks!


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