Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. def get_answer(prompt):
  2.     while True:
  3.         answer = input(prompt).strip().lower()
  4.         if answer in ('yes', 'no'):
  5.             return answer == 'yes'
  6.  
  7. print(get_answer('yes / no: '))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement