(prompt)
Ask a Yes/No question
Ask a Yes/No question
Ask a Yes / No question
def yesno(prompt):
    """Ask a Yes/No question"""
    while True:
        sys.stderr.write(prompt + " ")
        sys.stderr.flush()
        answer = sys.stdin.readline()
        if not answer:
            return False
        answer = answer.strip().lower()
        if answer in ('yes','y'):
            return True
        if answer in ('no','n'):
            return False
        sys.stderr.write("Please answer yes or no.\n")
def yesno ( prompt ) : while True : sys . stderr . write ( prompt + " " ) sys . stderr . flush ( ) answer = sys . stdin . readline ( ) if not answer : return False answer = answer . strip ( ) . lower ( ) if answer in ( 'yes' , 'y' ) : return True if answer in ( 'no' , 'n' ) : return False sys . stderr . write ( "Please answer yes or no.\n" )