Question: Write a Python program with the following requirements: Note: A file called data_file.txt will be used. The file will already contain data, and example of

Write a Python program with the following requirements: Note: A file called data_file.txt will be used. The file will already contain data, and example of the file contents is provided on Blackboard. You must create this file with some contents. The program shall: i. Ask the user to enter a 7-digit telephone number from the user. Check to make sure that the user has entered valid numbers only. If not, display a message. Check to make sure that the user has entered 7 digits. If not, display a message. ii. Lookup the number in the file data_file.txt. If the number already exists in the file, the program displays a message that the record already exists. If the number does not exist in the file, the number should be added to the end of the file as a new row. iii. Program should continue to run and accept numbers until the user decides to quit. You can decide how the user should quit perhaps enter Q to quit, or some other indication. Handle upper and lower case letters. Structure the code such that there is: 1.) a main part of the program, 2.) a main function, and 3.) a function that will process the number - it has one input parameter, phone_number, and it will read / write to the file Hint: You need to open the file in 'r+ ' mode (which allows both read and write). You can use the with open statement. You do not need to catch exceptions.

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!