def yesno ( prompt ) : prompt += " [y/n]" a = "" while a not in [ "y" , "n" ] : a = input ( prompt ) . lower ( ) return a == "y"
python how to write prompt that asks the user for input if the value doesnt match
Returns True if user answers y
def yesno(prompt):
    """Returns True if user answers 'y' """
    prompt += " [y/n]"
    a = ""
    while a not in ["y", "n"]:
        a = input(prompt).lower()

    return a == "y"