Function Not Defined?


#1



https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/1?curriculum_id=4f89dab3d788890003000096#


This looks fine to me, but when i try to run it, it says "Oops, try again. Did you create a function called count? Your code threw a "global name 'count' is not defined" error."


I'm pretty sure i did create a function called count.

Please Help!

def count(sequence,item):
    tally = 0
    for x in sequence:
        if x = item:
            tally += 1
        else:
            tally += 0
    return tally;


#2

look at the console window:
if x = item:
there is the interesting error message, you are assigning item to x instead of comparing item with x (two equal signs)


#3

Ohhhhh! Thanks a lot, I haven't been coding for a bit so I totally forgot that!