def get_user_choice(choices):
    """
    ask the user to choose from the given choices
    """

    # print choices
    for index, choice in enumerate(choices):
        print("[" + str(index) + "] " + choice)
    # get user input
    while True:
        user_input = input("\n" + "input: ")
        if (user_input.isdigit() is False) or (int(user_input) not in range(len(choices))):
            print("wrong input!")
        else:
            return int(user_input)