def add_new_contact(first_name1,
                    last_name1,
                    mobile_number1="",
                    work_number1="",
                    email1=""):
    first_name1 = first_name1.upper().strip()
    last_name1 = last_name1.upper().strip()
    email1 = email1.upper().strip()

    if not contact_list:
        print "Contact added to empty list"
        new_contact = contact.Contact(first_name=first_name1,
                                      last_name=last_name1,
                                      mobile_number=mobile_number1,
                                      work_number=work_number1,
                                      email=email1)
        contact_list.append(new_contact)
        return
    else:
        for info in contact_list:
            print info.first_name, info.last_name, "iterating"
            if first_name1 == info.first_name and last_name1 == info.last_name:
                print "Error, that contact already is in your contact list"
                return
            else:
                print "No matches found, adding a new contact", first_name1, last_name1
                new_contact = contact.Contact(first_name=first_name1,
                                              last_name=last_name1,
                                              mobile_number=mobile_number1,
                                              work_number=work_number1,
                                              email=email1)
                contact_list.append(new_contact)
                return
예제 #2
0
def main():
    # create a list to hold contacts
    contacts_list = []

    # prompt user to add a new contact.
    # prompt for each of the details and save the response.
    print "Add new contact"
    first = raw_input("What is the first name?")
    last = raw_input("What is the last name?")
    mobile = raw_input("What is your cell number?")
    email = raw_input("What is your email?")

    # create a new contact
    new_contact = contact.Contact(last_name=last,
                                  first_name=first,
                                  mobile_phone=mobile,
                                  email=email)

    # add contact to the list
    contacts_list.append(new_contact)

    # print out the contact info in the list.
    for info in contacts_list:
        print info.first_name
        print info.last_name
        print info.mobile_phone
        print info.email
예제 #3
0
파일: main.py 프로젝트: El-Treshka/Python
 def __add_new_contact(self):
     print("Adding contact")
     cont = contact.Contact()
     cont.set_name(input("Input name:"))
     cont.set_mobile_number(input("Input mobile number:"))
     cont.set_personal_number(input("Input personal number:"))
     cont.set_about(input("Input about:"))
     self.__phone_book.append(cont)
     self.__show_all_contacts()
예제 #4
0
def add(mycontacts):
  name=input('Name: ')
  phone=input('Phone: ')
  email=input('Email: ')
  entry = contact.Contact(name, phone, email)
  if name not in mycontacts:
    mycontacts[name]=entry
    print('The entry has been added.')
  else:
    print('That name already exists.')
예제 #5
0
def change(mycontacts):
  name=input('Enter a name: ')
  if name in mycontacts:
    phone=input('Enter the new phone number: ')
    email=input('Enter the new email address: ')
    entry=contact.Contact(name, phone, email)
    mycontacts[name] = entry
    print('Information updated.')
  else:
    print('That name is not found!')
예제 #6
0
def insertContact():
    name = input("insert Name:")
    while not CheckName(name):
        print("the name must have a Value")
        name = input("insert Name:")
    cellphone = input("insert cellphone:")
    while not CheckNumber(cellphone):
        print("the number must have only digit")
        cellphone = input("insert cellphone:")
    contactBook.append(contact.Contact(name, cellphone))
    pass
def add_new_contact(first_name, last_name):
    new_contact = contact.Contact(first_name,
                                  last_name,
                                  mobile_number="",
                                  email="",
                                  work_number="")
    contacts_list.append(new_contact)
    first_name = first_name.upper().strip
    for info in contacts_list:
        if first_name == info.first_name and last_name == info.last_name:
            print "Error! Contact already exists!"
예제 #8
0
def change(mycontacts): # Change a current entry in the database
	name = input("Please input a name to lookup: ")

	if name in mycontacts: # If the name is in the mycontacts database
		phone = input("Enter a new phone number: ")
		email = input("Enter a new email address: ")

		entry = contact.Contact(name, phone, email) # Create a new contact entry
		mycontacts[name] = entry # Update the entry in the current dictionary with the new object
		print("Information updated!")
	else:
		print("That name is not found")
예제 #9
0
파일: main.py 프로젝트: El-Treshka/Python
 def __import_contacts(self):
     with open('contacts.json') as json_file:
         data = json.load(json_file)
         self.__phone_book = list()
         for contacts_list in data['contacts']:
             cont = contact.Contact()
             cont.set_name(contacts_list['name'])
             cont.set_mobile_number(contacts_list['mobile number'])
             cont.set_personal_number(contacts_list['personal number'])
             cont.set_about(contacts_list['about'])
             self.__phone_book.append(cont)
     self.__open_menu()
예제 #10
0
def main(): # Create a basic function to test the cellphone class
	# Let us get all the phone data
	a = input("Please input the name of your contact: ")
	b = input("Please input the phone number of your contact: ")
	c = input("Please input the e-mail of your contact: ")

	# Create an instance of the CellPhone class
	address = contact.Contact(a, b, c) # This class is created using the three inputs which are passed to the new object

	# Display the data that was entered
	print("The name of your contact is:", address.get_name()) 
	print("The phone number of your contact is:", address.get_phone()) 
	print("The email of your contact is:", address.get_email()) 
예제 #11
0
def add(mycontacts): # Add a new entry into the specified dictionary
	name = input("Name: ") # Get the name
	phone = input("Phone: ") # Get the phone
	email = input("Email: ") # Get the email

	entry = contact.Contact(name, phone, email) # Create a new object using the Contact class

	# If the name does not exist, add it as a key
	if name not in mycontacts:
		mycontacts[name] = entry
		print("The entry has been added!")
	else:
		print("That name already exists in the management system!")
예제 #12
0
def main():
    # create an instance of Contact
    new_contact = contact.Contact(first_name="Diana", last_name="Smith", 
        mobile_phone="555-555-5555")

    # change an attribute
    new_contact.last_name = "Banana"

    #call a method
    new_contact.send_text("Hello, everyone!")
    new_contact.send_email("Hey what's up?")
    # print the attributes
    print new_contact.mobile_phone
    print new_contact.last_name
예제 #13
0
def createContact(ch, olderContact=None):
    if ch == ContactType[0]:
        directory.append(contact.Contact(olderContact))
    elif ch == ContactType[1]:
        directory.append(contact.FriendContact(olderContact))
    elif ch == ContactType[2]:
        directory.append(contact.ProfessionalContact(olderContact))
    elif ch == ContactType[3]:
        directory.append(contact.ProfessionalFriendContact(olderContact))
    else:
        print("you have entered an invalid choice")
        start()

    directory.sort()
def main():
    new_contacts = []
    first_name = raw_input("What is your first name?")
    last_name = raw_input("What is your last name?")
    mobile = raw_input("What is your mobile?")
    email = raw_input("What is your email?")

    js = contact.Contact(first_name, last_name, mobile, email)
    new_contacts.append(js)

    for contact_object in new_contacts:
        print contact_object.first_name
        print contact_object.last_name
        print contact_object.mobile_number
        print contact_object.email
예제 #15
0
def main():
    # create an instance of Contact
    new_contact = contact.Contact(first_name="Diana",
                                  last_name="Banana",
                                  mobile_phone="555-555-5000")
    # change an attribute
    new_contact.last_name = "Smith"
    # call a method
    new_contact.send_text("Hello! How are you?")

    # print the attributes
    # print new_contact
    print new_contact.first_name
    print new_contact.last_name
    print new_contact.mobile_phone
예제 #16
0
def replaceSimpleContact(ReplacedContact):
    name = input(("name: ( %s )") % (ReplacedContact.getName()))
    while not CheckName(name):
        print("the name must have a Value")
        name = input(("name: (%s)") % ReplacedContact.getName())
    cellphone = input(("cellphone: (%s)") % ReplacedContact.getCellphone())
    while not CheckNumber(cellphone):
        if cellphone != 'x':
            print("the number must have only digit")
            cellphone = input(
                ("cellphone: (%s)") % ReplacedContact.getCellphone())
        else:
            cellphone = ""
    contact.Contact(name, cellphone, ReplacedContact)
    pass
예제 #17
0
def main():
    contacts = []
    new_contact_first = raw_input("What is your first name?")
    new_contact_last = raw_input("what is your last name?")
    new_contact_phone = raw_input("what is your phone number?")
    new_contact_email = raw_input("what is your email?")
    new_contact_birthday = raw_input("what is your birthday?")
    new_contact = contact.Contact(new_contact_first, new_contact_last,
                                  new_contact_phone, new_contact_email,
                                  new_contact_birthday)

    contacts.append(new_contact)

    for person in contacts:
        print person.first_name, person.last_name, person.email, person.birthday, person.phone_number
def add(mycontacts):
    # Get the contact info.
    name = input('Name: ')
    phone = input('Phone: ')
    email = input('Email: ')

    # Create a Contact object name entry.
    entry = contact.Contact(name, phone, email)

    # If the name does not exist in the dictionary, add it as a 
    # key with the entry object as the associated value.
    if name not in mycontacts:
        mycontacts[name] = entry
        print('The entry has been added.')
    else:
        print('That name already exists.')
예제 #19
0
def add(mycontacts):
    # Pobranie informacji o osobie.
    name = input('Imię i nazwisko: ')
    phone = input('Numer telefonu: ')
    email = input('Adres e-mail ')

    # Utworzenie obiektu klasy Contact o nazwie entry.
    entry = contact.Contact(name, phone, email)

    # Jeżeli osoba nie znajduje się w słowniku,
    # zostanie dodana jako klucz wraz z wartością
    # w postaci obiektu entry.
    if name not in mycontacts:
        mycontacts[name] = entry
        print('Osoba została dodana.')
    else:
        print('Podana osoba już istnieje.')
예제 #20
0
def add(mycontacts):
    # Получить контактную информацию.
    name = input('Имя: ')
    phone = input('Телефон: ')
    email = input('Электронный адрес: ')

    # Создать именованную запись с объектом Contact.
    entry = contact.Contact(name, phone, email)

    # Если имя в словаре не существует, то
    # Добавить его в качестве ключа со связанным с ним
    # значением в виде объекта.
    if name not in mycontacts:
        mycontacts[name] = entry
        print('Запись добавлена.')
    else:
        print('Это имя уже существует.')
def add(mycontacts):
    # get the contact info.
    name = input("Name: ")
    phone = input("Phone: ")
    email = input("Email: ")

    # create a Contact object named entry.
    entry = contact.Contact(name, phone, email)

    # if the name does not exist in the dictionary,
    # add it as a key with the entry object as the
    # associated value.
    if name not in mycontacts:
        mycontacts[name] = entry
        print("The entry has been added.")
    else:
        print("That name already exists.")
예제 #22
0
def change(mycontacts):
    # Get a name to look up.
    name = input('Enter a name: ')
    if name in mycontacts:
        # Get a new phone number.
        phone = input('Enter the new phone number: ')

        # Get a new email address.
        email = input('Enter the new email address: ')

        # Create a contact object named entry.
        entry = contact.Contact(name, phone, email)

        # Update the entry.
        mycontacts[name] = entry
        print('Information updated.')
    else:
        print('That name is not found.')
예제 #23
0
def change(mycontacts):
    # Pobranie imienia i nazwiska do wyszukania.
    name = input('Podaj imię i nazwisko: ')

    if name in mycontacts:
        # Pobranie nowego numeru telefonu.
        phone = input('Podaj nowy numer telefonu: ')

        # Pobranie nowego adresu e-mail.
        email = input('Podaj nowy adres e-mail: ')

        # Utworzenie obiektu klasy Contact o nazwie entry.
        entry = contact.Contact(name, phone, email)

        # Uaktualnienie informacji o osobie.
        mycontacts[name] = entry
        print('Informacje zostały uaktualnione.')
    else:
        print('Nie znaleziono osoby.')
예제 #24
0
def change(mycontacts):
    # Получить искомое имя.
    name = input('Введите имя: ')

    if name in mycontacts:
        # Получить новый телефонный номер.
        phone = input('Введите новый телефоный номер: ')

        # Получить новый электронный адрес.
        email = input('Введите новый электронный адрес: ')

        # Создать именованную запись с объектом Contact.
        entry = contact.Contact(name, phone, email)

        # Обновить запись.
        mycontacts[name] = entry
        print('Информация обновлена.')
    else:
        print('Это имя не найдено.')
def change(mycontacts):
    # get a name to look up.
    name = input("Enter a name: ")

    if name in mycontacts:
        # get a new phone number.
        phone = input("Enter the new phone number: ")

        # get a new email address.
        email = input("Enter the new email address: ")

        # create a contact object named entry
        entry = contact.Contact(name, phone, email)

        # update the entry.
        mycontacts[name] = entry
        print("Information updated.")
    else:
        print("That name is not found.")
def addContact():
    flag = 13
    while flag == 13:
        exp = map(lambda x: re.compile(x), [
            r'^([a-zA-Z]+)$', r'^(\+)?(\d)+$',
            r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
        ])

        fName = str(raw_input('Enter first name : ')).strip()
        while not exp[0].match(fName):
            fName = str(
                raw_input(
                    '\nWrong Input\nEnter (proper) first name : ')).strip()

        lName = str(raw_input('Enter last name : ')).strip()
        while not exp[0].match(lName):
            lName = str(raw_input(
                '\nWrong Input\nEnter (proper) last name : ')).strip()

        pNum = str(raw_input('Enter phone number : ')).strip()
        while not exp[1].match(pNum):
            pNum = str(
                raw_input('\nWrong Input\nEnter (proper) number : ')).strip()

        email = str(raw_input('Enter email(Blank for none) : ')).strip()
        while not exp[2].match(email):
            if not email:
                break
            email = str(
                raw_input('\nWrong Input\nEnter (proper) email : ')).strip()

        print app.addEntry(contact.Contact(fName, lName, pNum, email))

        while (flag < 1) or (flag > 3):
            flag = getOption(
                '\n1. Add another.\n2. Go to main menu\n3. Exit.\n\n> ')
        if flag == 2:
            break
        elif flag == 3:
            exitProg()
        else:
            flag = 13
예제 #27
0
    def __init__(self, dt=1e-3):

        self.dt = dt
        self.u_l = np.zeros(4)
        self.u_r = np.zeros(4)

        left = 1
        right = 0
        # height constant
        # self.hconst = 0.8325
        self.hconst = 0.8325

        self.leg_left = leg.Leg(dt=dt, leg=left)
        self.leg_right = leg.Leg(dt=dt, leg=right)
        controller_class = wbc
        self.controller_left = controller_class.Control(dt=dt)
        self.controller_right = controller_class.Control(dt=dt)
        self.force = mpc.Mpc(dt=dt)
        self.contact_left = contact.Contact(leg=self.leg_left, dt=dt)
        self.contact_right = contact.Contact(leg=self.leg_right, dt=dt)
        self.simulator = simulationbridge.Sim(dt=dt)
        self.state_left = statemachine.Char()
        self.state_right = statemachine.Char()

        # gait scheduler values
        self.target_init = np.array([
            0, 0, -self.hconst
        ])  # , self.init_alpha, self.init_beta, self.init_gamma])
        self.target_l = self.target_init[:]
        self.target_r = self.target_init[:]
        self.sh_l = 1  # estimated contact state (left)
        self.sh_r = 1  # estimated contact state (right)
        self.dist_force_l = np.array([0, 0, 0])
        self.dist_force_r = np.array([0, 0, 0])
        self.t_p = 0.5  # gait period, seconds 0.5
        self.phi_switch = 0.75  # switching phase, must be between 0 and 1. Percentage of gait spent in contact.
        self.gait_left = gait.Gait(controller=self.controller_left,
                                   robotleg=self.leg_left,
                                   t_p=self.t_p,
                                   phi_switch=self.phi_switch,
                                   hconst=self.hconst,
                                   dt=dt)
        self.gait_right = gait.Gait(controller=self.controller_right,
                                    robotleg=self.leg_right,
                                    t_p=self.t_p,
                                    phi_switch=self.phi_switch,
                                    hconst=self.hconst,
                                    dt=dt)

        self.target = None

        # footstep planner values
        self.omega_d = np.array(
            [0, 0, 0])  # desired angular acceleration for footstep planner
        # self.k_f = 0.15  # Raibert heuristic gain
        self.k_f = 0.3  # Raibert heuristic gain
        self.h = np.array([0, 0,
                           self.hconst])  # height, assumed to be constant
        self.r_l = np.array([0, 0, -self.hconst
                             ])  # initial footstep planning position
        self.r_r = np.array([0, 0, -self.hconst
                             ])  # initial footstep planning position
        self.rh_r = np.array([.03581, -.14397,
                              .13519])  # vector from CoM to hip
        self.rh_l = np.array([.03581, .14397,
                              .13519])  # vector from CoM to hip

        self.p = np.array([0, 0, 0])  # initial body position
        # self.pdot_des = np.array([0.01, 0.05, 0])  # desired body velocity in world coords
        self.pdot_des = np.array([0, 0,
                                  0])  # desired body velocity in world coords
        self.force_control_test = False
        self.useSimContact = True
        self.qvis_animate = False
        self.plot = False
예제 #28
0
파일: main.py 프로젝트: zpltys/DeepFragLib
    print ("Build Fragment Library for Target {}".format(TargetName))

    Database = chain.DBFrag()
    Database.build_db(db_label, isRmHomol, TargetProt.homol)

    AllFeats = features.CalcFeature(TargetProt, Database.chains)
    AllFeats.get_feats_result()

    print ("Done! Build DataBase")

    # Attention: It will need some time to load the model! Be patient!
    RegModel = models.Model_Regression()
    print ("Regression Model Loaded.")

    Contact = contact.Contact(TargetProt)
    TargetProt.contact_vec = Contact.pred_contact()
    print ("Contact Prediction Models Done.")

    AllCandids = [[] for _ in range(TargetProt.length-7+1)]

    # loop from length=7 to length=15
    for FragLen in range(7, 16):
        print ("Fragment Length = {}".format(FragLen))
        gc.collect()

        ClassifyModel = models.Model_Classify(FragLen, TargetProt, Database.chains, AllFeats, Contact, gpu_id)

        for i in range(TargetProt.length-FragLen+1):
            top_candids_info = ClassifyModel.predict(i)
            RegModel.predict(top_candids_info)
예제 #29
0
import contact
import phonebook

if __name__ == '__main__':
    anton = contact.Contact('Anton',
                            'Vasilyev',
                            '+7123',
                            telegram='telega',
                            email='*****@*****.**',
                            work_phone='+7456')
    vasya = contact.Contact('Vasya',
                            'Pupkin',
                            '+7697',
                            fav_contact='Anton Vasilyev',
                            email='*****@*****.**')
    pb = phonebook.PhoneBook('Телефонная книга')

    # print(anton)
    # print(vasya)
    # Карточка контакта

    pb.add_contact(anton)
    pb.add_contact(vasya)
    # Добавляем контакты

    pb.show_contacts()
    # Показать добавленные контакты

    pb.del_contact('+7123')
    # Удаление контакта
예제 #30
0
def contact_file():
    print("CONTACT BOOK\n")

    menu = {}
    menu["1"] = "View list of contacts"
    menu["2"] = "Add contact"
    menu["3"] = "Change contact"
    menu["4"] = "Delete contact"
    menu["5"] = "Search for contact"
    menu["6"] = "Delete all contacts"
    menu["7"] = "Add random contacts"
    menu["8"] = "Exit"

    for k, v in menu.items():
        print("{}) {}".format(k, v))

    file_name = "Contact_Book"
    user_input = input()

    if (user_input == "1"):
        os.system("clear")
        print("CONTACT BOOK")
        print("Enter any key to exit\n")

        infile = open(file_name, "rb")
        contact_list = pickle.load(infile)
        i = 1
        print(
            "----------------------------------------------------------------------------"
        )
        for con in contact_list:
            print("{}    {} {} {} {} {}".format(i, con.first_name,
                                                con.last_name,
                                                con.phone_number, con.birthday,
                                                con.address))
            print(
                "----------------------------------------------------------------------------"
            )
            i += 1

        user_input = input()
        if (user_input == 0):
            os.system("clear")
            contact_file()
        else:
            os.system("clear")
            contact_file()

    elif (user_input == "2"):
        os.system("clear")
        print("CREATE NEW CONTACT\n")
        print("Enter '_SKIP' for any field to skip\n")
        print("Enter '_EXIT' to exit\n")

        first_name = input("Enter contact's first name\n")
        last_name = input("Enter contact's last name\n")
        phone_number = input(
            "Enter contact's phone number in form of (XXX)XXX-XXXX\n")
        birthday = input("Enter contact's birthday in from off XX/XX/XXX\n")
        address = input("Enter user's address\n")

        new_contact = contact.Contact(first_name, last_name, phone_number,
                                      birthday, address)

        infile = open(file_name, "rb")
        contact_list = pickle.load(infile)
        contact_list.append(new_contact)
        infile.close()

        outfile = open(file_name, "wb")
        pickle.dump(contact_list, outfile)
        outfile.close()

        os.system("clear")
        print("Contact successfully added\n")
        contact_file()

    elif (user_input == "3"):
        os.system("clear")
        print("CHANGE CONTACT\n")

        infile = open(file_name, "rb")
        contact_list = pickle.load(infile)
        infile.close()

        print("Choose contact to change or enter '_EXIT' to exit\n")

        i = 1
        for cont in contact_list:
            print("{}) {} {} {} {} {}".format(i, cont.first_name,
                                              cont.last_name,
                                              cont.phone_number, cont.birthday,
                                              cont.address))
            i += 1

        user_input = input()

        try:
            if (int(user_input) >= 1 or int(user_input) <= len(contact_list)):
                changing_contact = contact_list[int(user_input) - 1]
                os.system("clear")
                print("Updating contact\n")
                lil_menu = {}
                lil_menu["1"] = "Update first name"
                lil_menu["2"] = "Update last name"
                lil_menu["3"] = "Update phone number"
                lil_menu["4"] = "Update DOB"
                lil_menu["5"] = "Update address"
                lil_menu["6"] = "Cancel"
                for k, v in lil_menu.items():
                    print("{}) {}".format(k, v))
                user_input2 = input()
                update_contact(changing_contact, user_input2)
            else:
                os.system("clear")
                print("ERROR 583: Invalid input\n")

        except ValueError:
            if (user_input == "_EXIT"):
                os.system("clear")
                print(">>>>>Cancelled action\n")
                contact_file()
            else:
                os.system("clear")
                print("ERROR 493: Invalid input\n")
                contact_file()

        outfile = open(file_name, "wb")
        pickle.dump(contact_list, outfile)
        outfile.close()

        os.system("clear")
        print(">>>>>Contact updated\n")
        contact_file()
    elif (user_input == "4"):
        os.system("clear")
        print("DELETE CONTACT")
        print("Choose contact to change or enter '_EXIT' to exit\n")

        infile = open(file_name, "rb")
        contact_list = pickle.load(infile)
        infile.close()

        i = 1
        for cont in contact_list:
            print("{} {} {} {} {} {}".format(i, cont.first_name,
                                             cont.last_name, cont.phone_number,
                                             cont.birthday, cont.address))
            i += 1
        user_input = input()
        try:

            if int(user_input) >= 1 and int(user_input) <= len(contact_list):
                del contact_list[int(user_input) - 1]

                outfile = open(file_name, "wb")
                pickle.dump(contact_list, outfile)
                outfile.close()

                os.system("clear")
                print(">>>>>Contact deleted\n")
                contact_file()
            else:
                os.system("clear")
                print(">>>>>ERROR 593: Invalid input\n")
                contact_file()

        except ValueError:
            os.system("clear")
            print("Action cancelled\n") if user_input == "_EXIT" else print(
                "ERROR 309: Invalid input\n")
            contact_file()
    elif (user_input == "5"):
        os.system("clear")
        print("SEARCH FOR CONACT")
        print(
            "Would you like to search for name by first name, last name, phone number, DOB, or address?\n"
        )

        lil_menu = {}
        lil_menu["1"] = "First Name"
        lil_menu["2"] = "Last Name"
        lil_menu["3"] = "Phone Number"
        lil_menu["4"] = "Date of Birth"
        lil_menu["5"] = "Address"
        lil_menu["6"] = "Exit"

        for k, v in lil_menu.items():
            print("{} {}".format(k, v))

        infile = open(file_name, "rb")
        contact_list = pickle.load(infile)
        infile.close()
        user_input = input()
        matching_list = []
        matching_contacts = []

        if (user_input == "1"):
            # returns a list
            matching_contacts = sift_through(matching_list, contact_list,
                                             "first_name",
                                             input("Enter first name:\t"))
        elif (user_input == "2"):
            matching_contacts = sift_through(matching_list, contact_list,
                                             "last_name",
                                             input("Enter last name:\t"))
        elif (user_input == "3"):
            matching_contacts = sift_through(
                matching_list, contact_list, "phone_number",
                input("Enter phone number in form of (XXX)XXX-XXXX:\t"))
        elif (user_input == "4"):
            matching_contacts = sift_through(
                matching_list, contact_list, "birthday",
                input("Enter DOB in form of XX/XX/XXX:\t"))
        elif (user_input == "5"):
            matching_contacts = sift_through(matching_list, contact_list,
                                             "address",
                                             input("Enter address:\t"))
        elif (user_input == "6"):
            os.system("clear")
            contact_file()

        else:
            os.system.clear()
            print("ERROR 207: Invalid input\n")
            contact_file()
        print("-------------------------------------------------------\n")
        for cont in matching_contacts:
            print("{} {} {} {} {}\n".format(cont.first_name, cont.last_name,
                                            cont.phone_number, cont.birthday,
                                            cont.address))

        user_input = input("\nEnter any key to exit\n")
        os.system("clear")
        contact_file()

    elif (user_input == "6"):
        os.system("clear")
        print("DELETE ALL CONTACTS\n")

        print(
            "Are you sure you want to delete all contacts? This cannot be undone.\n"
        )
        print("1) Yes\n")
        print("2) No\n")

        user_input = input()
        if user_input == "1":
            outfile = open(file_name, "wb")
            pickle.dump([], outfile)
            outfile.close()
            os.system("clear")
            print(">>>>>All contacts deleted\n")
            contact_file()
        elif user_input == "2":
            os.system("clear")
            print(">>>>>Action Cancelled\n")
            contact_file()
        else:
            os.system("clear")
            print(">>>>>ERROR 492: Invalid Input\n")
            contact_file()

    elif (user_input == "7"):
        os.system("clear")
        print("ADDING RANDOM CONTACTS TO CONTACT BOOK\n")

        user_input = int(
            input("How many random contacts do you want to add?\n"))
        infile = open(file_name, "rb")
        contact_list = pickle.load(infile)
        infile.close()

        outfile = open(file_name, "wb")

        for i in range(user_input):
            rand_f_name = names.get_first_name()
            rand_l_name = names.get_last_name()
            rand_p_number = "({}){}-{}".format(randint(100, 999),
                                               randint(100, 999),
                                               randint(1000, 9999))
            rand_birthday = "{}/{}/{}".format(randint(1, 13), randint(1, 31),
                                              randint(1900, 2021))
            new_contact = contact.Contact(rand_f_name, rand_l_name,
                                          rand_p_number, rand_birthday, "NA")
            contact_list.append(new_contact)
        pickle.dump(contact_list, outfile)
        outfile.close()

        os.system("clear")
        print("Successfully added {} contacts".format(user_input))
        contact_file()

    elif (user_input == "8"):
        os.system("clear")

    else:
        os.system("clear")
        print(">>>>>ERROR 001: Invalid Input\n")
        contact_file()