Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1.  
  2. def query_yes_no(question, true='yes', false='no'):
  3. while True:
  4. print (question + ' [' + true[0] + '/' + false[0] + ']'),
  5. choice = raw_input().lower()
  6. if choice in (true, true[0]):
  7. return True
  8. if choice in (false, false[0]):
  9. return False
  10. else:
  11. print "Please respond with '" + true + "' or '" + false +\
  12. "' (or '" + true[0] + "' or '" + false[0] + "').\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement