Exemplo n.º 1
0
def get_phone_by_name(search_str):
    for i in list_of_names:
        if i == search_str:
            index = list_of_names.index(i)
            phoneno = list_of_phone_numbers[index]
            print(results.result_by_name(search_str, phoneno))
            menu.blank_line()
Exemplo n.º 2
0
def get_name_by_phone(search_str):
    for i in list_of_phone_numbers:
        if i == search_str:
            index = list_of_phone_numbers.index(i)
            name = list_of_names[index]
            print(results.result_by_phone(search_str, name))
            menu.blank_line()
Exemplo n.º 3
0
def del_entry(name):
    # had to reset this from the global to prevent a crash on data that is not
    # included in the dataset.  Perhaps there is a different way to do this!
    list_of_names = [i["name"] for i in book.phonebook]

    index = list_of_names.index(name)
    del book.phonebook[index]
    print(results.result_by_delete(name))
    menu.blank_line()
Exemplo n.º 4
0
def select_option():
    user_choice = input("What do you want to do (1-5)? ")
    menu.blank_line()
    return user_choice
Exemplo n.º 5
0
def add_new_entry(name, phoneno):
    new_dict = {'name': name, 'phone': phoneno}
    book.phonebook.append(new_dict)
    print(results.result_by_add(name))
    menu.blank_line()