Q:

Python input does not compare properly

I did this on test today and came back to test it. I know better ways to do this but why is this not working?
def f():
    e=raw_input('enter number')
    if e in range (12):
        print 'co'
    if e in range (12,20):
        print 'co2'
    if e in range (-10,0,1):
        print 'co3'

f()

A:

e is a string and you compare it to an int
do
def f():
    e=int(raw_input('enter number'))
    if e in range (12):
        print 'co'
    elif e in range (12,20):
        print 'co2'
    elif e in range (-10,0,1):
        print 'co3'

f()

instead

