Function Not Defined?


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
            tally += 0
    return tally;


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)


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