def prompt_yes_or_no ( message ) : user_input = input ( "{} [y/n]:" . format ( message ) ) . lower ( ) if user_input . startswith ( "y" ) : return True elif user_input . startswith ( "n" ) : return False else : return prompt_yes_or_no ( message )
how to return a y/n question in python using if then
prompt_yes_or_no : Prompt user to reply with a y / n response Args : None Returns : None
def prompt_yes_or_no(message):
    """ prompt_yes_or_no: Prompt user to reply with a y/n response
        Args: None
        Returns: None
    """
    user_input = input("{} [y/n]:".format(message)).lower()
    if user_input.startswith("y"):
        return True
    elif user_input.startswith("n"):
        return False
    else:
        return prompt_yes_or_no(message)