def ask_yes_no(prompt="[y/n] :", default="y", valid=["y", "n"]):
    """Display a yes/no question and loop until a valid answer is entered
    
    Keyword Arguments:
        prompt {str} -- the question message (default: {'[y/n] :'})
        default {str} -- the default answer if there is no answer (default: {"y"})
        valid {list} -- the list of appropriate answers (default: {["y", "n"]})
    
    Returns:
        str -- the answer
    """

    answer = input(prompt)
    if answer in valid:
        return answer
    elif answer == "":
        return default
    else:
        return ask_yes_no(prompt, default, valid)