Q:

Python chars compare in if/else

The goal is to get a y or n and do different things based on the if/elseif/else statement. The problem is that it does not see y and n as proper values. Anyone know what I am doing wrong?
print 'Are you happy with the final crop?'
happyTest = raw_input('Enter y or n: ')
if happyTest == 'y':
    happy = False
elif happy == 'n':
    padding == int(raw_input('Enter crop padding:'))
else:
    print 'Not a valid input'

A:

You've got two problems I can see:

elif happy == 'n': references an undefined variable, happy. You meant happyTest.
padding == int(raw_input('Enter crop padding:')) tries to compare padding and int(...). You meant to assign. Change == to =.

