Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

12.1 Define the concept of personality disorders.

Answered: 1 week ago

Question

8. Explain the difference between translation and interpretation.

Answered: 1 week ago

Question

10. Discuss the complexities of language policies.

Answered: 1 week ago

Question

1. Understand how verbal and nonverbal communication differ.

Answered: 1 week ago