def ask_for_int(sentence: str) -> int:
    """
    Ask the user for an integer.
    """
    while True:
        try:
            return int(input(sentence))
        except ValueError:
            print("Invalid input. Please try again.")