0
low = 0
high = 100
print "Please think of a number between 0 and 100!"
guess = 0
guess =high/2
print "Is your secret number: %d" % guess
while (guess <= 100 ):
    value = raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly.")
if(value == 'h'):
     high = guess;
     guess =(low+guess)/2
     print "Is your secret number: %d" % guess 
elif(value == 'l'):
        low =  guess
        guess = (low + high)/2
        print "Is your secret number: %d" % guess 
elif(value == 'c' or "right" or "yes" or 'okay' or "correct"):
        print "Game over. Your secret number was: %d" %guess
        break
else:
    print "Sorry, I did not understand your input."

If i have entered value ="right", in the elif block i have expected the code to check against the entire word. But on execution it is allowing any letters. Can someone help me how to fix this?

Usr_Dev
  • 77
  • 1
  • 1
  • 9
  • can you please tag the original question? – Usr_Dev Jul 14 '15 at 03:09
  • It is right there on top. [How do I test one variable against multiple values?](http://stackoverflow.com/questions/15112125/how-do-i-test-one-variable-against-multiple-values) – Bhargav Rao Jul 14 '15 at 03:10

0 Answers0