I am trying to use the str built in function. I get this error:
Traceback (most recent call last): File "python", line 12, in <module> NameError: name 'eggs' is not defined
I was under the idea that str(item) would turn any variable into a string. This would allow any variable added to 'Sequence' and 'Item' to be turned into strings so I can compare them together.
The idea behind it is that the CodeAcademy states:'
'3. The item you input may be an integer, string, float, or even another list!
def count(sequence, item): total = 0 t = str(item) m = str(sequence) for x in m: print 'test 1' #This is a test to check loop if t in x: print ' test 2' #This is a test to check loop total += 1 return total print count(['bacon', 'eggs', 'cheese', 'eggs'],eggs)
Any tips or insight?