Question: Assignment:Your job is to program an interface that allows the user to open, read, write, and add on to files.All of the files should contain
Assignment:Your job is to program an interface that allows the user to open, read, write, and add on to files.All of the files should contain integer values. There should be a menu that the user loopsthrough until they decide to exit the program.You should use the following functions (required):checkFile -Parameter: filenameReturn value: valid file or a flag for invalid filesPurpose: Should determine whether a file is valid (exists) or not. If it is, return theopened file. If its not, return a flag the main function can use.checkInt -Parameter: valueReturn value: valid number or a flag for invalid intPurpose: Should determine whether a number is invalid or not. If it is, return thevalid integer. If its not, return a flag the main function can use.main -Parameter: noneReturn value: nonePurpose: Display the menu and loop until the user is done. Get any inputs fromthe users and display any needed outputs.Your checkFile and checkInt functions should not have any input/output. Your programshould also utilize try/except blocks. It should not crash based on a file not existing/incorrectvalues being passed to an int conversion.Your menu should contain/handle:Exit optionRead fileGets a file from the user and validates that its an existing file. If it is, it shouldprint the entire contents (without any extra whitespace). You must use readline(),not read() for this.Write to a file
Gets a file from the user. Loops while the user wants to continue entering innumbers; it should validate that the number is an integer. If it is, it should write tothe file; if its not, it should display an error message.Append to a fileGets a file from the user. Loops while the user wants to continue entering innumbers; it should validate that each number is an integer. If it is, it should writeto the file; if its not, it should display an error message.Invalid option error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
