Exemplo n.º 1
0
            system('cls')
            name_of_the_person_that_will_be_deleted = input(
                'Type the name that will be deleted: ').strip().upper()
            if contact.check_if_name_exists(
                    list_of_contacts, dic,
                    name_of_the_person_that_will_be_deleted):
                contact.show_wanted_contact(
                    list_of_contacts, dic,
                    name_of_the_person_that_will_be_deleted)
                phone_of_the_person_that_will_be_deleted = input(
                    'Type the phone number that will be deleted: ').strip()
                if contact.check_if_phoneNumber_exists(
                        list_of_contacts, dic,
                        phone_of_the_person_that_will_be_deleted):
                    contact.del_contact(
                        list_of_contacts, dic,
                        phone_of_the_person_that_will_be_deleted)
                else:
                    print('Incorrect! Try again!')
            else:
                print(
                    f'{name_of_the_person_that_will_be_deleted} was not found!'
                )

        # Change contact
        elif options == '3':
            system('cls')
            name_of_the_person_that_will_be_changed = input(
                'Type the name that will be changed: ').strip().upper()
            if contact.check_if_name_exists(
                    list_of_contacts, dic,
Exemplo n.º 2
0
            system('cls')
            contact.add(list_of_contacts, dic)

        elif options == '2':
            system('cls')
            search_to_delete = input('{:>75}'.format(
                'Who are you looking for to delete? ')).upper().strip()
            # Shows who is going to be deleted
            if contact.search(list_of_contacts, dic, search_to_delete) == True:
                contact.show_wanted_contact(list_of_contacts, dic,
                                            search_to_delete)
                delete = input('{:>75}'.format(
                    'Type the contact phone number that you wanna delete: ')
                               ).strip()
                if contact.delete(list_of_contacts, dic, delete) == True:
                    contact.del_contact(list_of_contacts, dic, delete)
                    print(f'{search_to_delete:>70} has been deleted.')
                else:
                    print('{:^150}'.format('Incorrect! Try again!'))
            else:
                print(f'{search_to_delete:^150} was not found.')

        elif options == '3':
            system('cls')
            search_to_change = input('{:>75}'.format(
                'Who are you looking for to change? ')).upper().strip()
            # Shows who is going to be changed
            if contact.search(list_of_contacts, dic, search_to_change) == True:
                contact.show_wanted_contact(list_of_contacts, dic,
                                            search_to_change)
                phone_change = input('{:>75}'.format(