Exemplo n.º 1
0
        )
        user_choice = input("\nWhat do you want to do?: ")
        if user_choice == "a":
            contact_name = input("Enter contact name: ")
            if len(contact_name.strip(" ")) == 0:
                print("Names cannot be empty.")
                continue
            elif contacts.contact_exists(contact_name):
                print("Contact already exists.")
                continue
            else:
                contact_phone = input("Enter contact phone: ")
                if len(contact_phone.strip(" ")) == 0:
                    print("Numbers cannot be empty.")
                    continue
                else:
                    contact = {"name": contact_name, "phone": contact_phone}
                    contacts.add_contacts(contact)
                    print("Contact added.\n")
                    continue
        elif user_choice == "d":
            contacts.delete_contact()
            continue
        elif user_choice == "s":
            contacts.save_excel(f"{input('File name: ')}.xlsx")
            break
        else:
            print("Invalid input. Value must be one of type 'a', 'b' or 'c'.")
    except:
        break