def choose(num_max, text_options):
    """Asks the user to make a choice: either a number from 1 to num_max or a
    string in the list text_options.
    """
    while True:
        choice = input("Choice: ").lower()
        if choice in text_options:
            return choice
        try:
            num_choice = int(choice)
        except:
            num_choice = 0
        if num_choice > 0 and num_choice <= num_max:
            return num_choice

        print("Invalid choice. Options are numbers from 1 to %d, and %s."
              % (num_max, ", ".join(text_options)))