Example of to Create a menu-driven Python program that functions…
Question Answered step-by-step Example of to Create a menu-driven Python program that functions… Example of to Create a menu-driven Python program that functions like a phone book. Input is from a data file called phone.txt that consists of comma-separated values with one entry per line. The format of the input line is as follows:name, phoneFor formatting purposes, name is at most 20 characters and phone is at most 14 characters. Click phone.txt for an example input file.Click example_output_final.txt for an example run of the program. The run of the program should show you everything you need to do including the formatted display of the phone entries. Note that any changes to the phone book are written back to phone.txt at the end of the program. That way when the program is run again, the content of the phone book is what it was at the end of the last run of the program. Notes and RequirementsYou must use a list to store the name, phone pairs. ( e.g. [[‘Polly Ester’,’549-5393′], [‘Jack Hammer’,’277-4829′]] )Use functions where appropriate. The main part of your program should be at the bottom and not interspersed between the functions. The main part of your program should consist mostly of function calls. In fact, you should use my main program.Click main_final.txt.Functions you should have (you already implemented the following four functions from Assignment 27)def readFile (filename)Input – filename : strOutput – phonebook : listdef writeFile (filename, phonebook)Input – filename : str, phonebook : listOutput – Nonedef menu (choices)Input – choices : listOutput – user’s choice : intdef printEntries (phonebook)Input – phonebook : listOutput – NoneFunctions you should implement for the Final Projectdef searchPhonebook (phonebook)Search for an entry from phonebookInput – phonebookOutput – search : listsearch is a sub-list of phonebook like [[‘Polly Ester’,’549-5393′]] if user inputs ‘Polly Ester’ to searchdef addToPhonebook (phonebook)Add an entry into phonebookInput – phonebookOutput – Nonedef deleteFromPhonebook (phonebook)Delete an entry from phonebookInput – phonebookOutput – NoneBe sure to use the exact name phone.txt for your input file name.Assume that phone.txt always exists. (i.e. There should be no FileNotFoundError occurred)For the Final Project, your program supports all 0 (i.e. exit), 1 (i.e. search), 2 (i.e. add), 3 (i.e. delete), and 4 (i.e. print entries) from the menuDocumentationAlong with your name block at the top of the program, give a description of what the program doeseach function should be preceded by comments that:give a good description of what the function doesfunction inputfunction outputYou are not required to turn in problem-solving and algorithm development for this program. Computer Science Engineering & Technology Python Programming CSIS 152 Share QuestionEmailCopy link Comments (0)


