def ask(prompt: str) -> bool:
    """Ask a yes/no question until user gives an understandable response."""
    inpt: str
    while True:
        # Normalize input to uppercase, no whitespace, then get first character
        inpt = input(prompt + "? ").upper().strip()[0]
        print()
        if inpt == "Y":
            return True
        elif inpt == "N":
            return False
        print("PLEASE ANSWER 'YES' OR 'NO'.")
    return False