Python chars compare in if/else -


the goal y or n , different things based on if/elseif/else statement. problem not see y , n proper values. know doing wrong?

print 'are happy 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 valid input' 

you've got 2 problems can see:

  1. elif happy == 'n': references undefined variable, happy. meant happytest.

  2. padding == int(raw_input('enter crop padding:')) tries compare padding , int(...). meant assign. change == =.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -