Question: Please use python For the following, all functions must have a proper docstring and annotations. Use try/except and in case of an error print a

Please use python

Please use python For the following, all functions must have a proper

For the following, all functions must have a proper docstring and annotations. Use try/except and in case of an error print a user-friendly message to the terminal and raise or re-raise the exception. For this problem we will develop a contact list, similar to what is on smartphones. The contact list data structure is a list of tuples with the following format (name, nickname, phone). For instance, a sample contact list could be [("Beyonce Knowles", "bey", "561-1234321"), ("Cardi B", "Belcalis", "305-4399521"), ("Earl Simmons", "DMX", "305-1010101")). The contact list must be stored in a Python list of tuples, as above, always sorted alphabetically on the name field. An empty contact list is represented by the empty list []. For your solution to get any credit do NOT use dictionaries. a) Write a function that adds a contact to a contact list. If the contact name existed before in the list then it will be changed to the new entry and the function returns False. Otherwise, the function should return True. b) Write a function that removes a contact from a contact list. If the contact name existed before in the list then the function returns True. Otherwise, the function should return False. c) Write a function that finds a contact tuple from a contact list by passing the contact name or contact nickname. Use default parameter values to deal with this choice. The function returns the tuple if the contact is found and returns None otherwise. d) Write a function that saves a contact list to a.CSV file. The function takes as parameter the file name. The CSV file format must have name, nickname, phones on a line for each contact in the list. e) Write a function that reads a contact list from a .CSV file with the format described for part d). The function takes as parameter the file name and returns the contact list object (... sorted alphabetically). f) Write a main function that tests all the functions above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!