Question: Using Python, create a Python module named phoney for cleaning and searching a list of telephone numbers. In North America, phone numbers consist of three

Using Python, create a Python module named phoney for cleaning and searching a list of telephone numbers.
In North America, phone numbers consist of three parts: XXX-YYY-ZZZZ where:
XXX: the area code
YYY: the exchange
ZZZZ: the station code/line of the individual
Requirements
You must use at least one list comprehension in your phoney module (you may use more than one)
Your phoney module should include the type/code hinting that specifies the expected data type for your function arguments.
Each function in your phoney module must also include a docstring that provides a brief overview of its functionality.
Starter Code
Starter code is provided to you in index.py and phoney.py.
A sample CSV file with 10 phone numbers is included in phone_numbers_sample.csv. YOU MUST DOWNLOAD AND USE A COMPLETE phone_numbers.csv FILE USING INSTRUCTIONS IN THE ASSIGNMENT.
Getting Started
Create a new directory named phoney_module_v1 inside your local root folder for this course.
Write your code in the phoney.py and index.py files inside the phoney_module_v1 directory.
You should be able to run your program by typing python index.py from the command line while you are in you phoney_module_v1 directory.
Instructions
Functions in the phoney Module:
clean_phone_numbers: Accepts a list of phone numbers and returns a list of phone numbers that contain precisely 10 digits. It removes any special characters from the numbers (parenthesis, hypens) and removes any number that is not precisely 10 characters long
find_number: Accepts a list of "clean" phone numbers and a search term. Searches the entire list for an exact match of the search term. Returns a string that reports the number of times the search term is found in the list.
find_areacode: Accepts a list of "clean" phone numbers and a search term. Searches the first three digits of each element in the list for an exact match of the search term. Returns a string that reports the number of times the search term is found in the list.
find_exchange: Accepts a list of "clean" phone numbers and a search term. Searches the digits at indices 3-5 of each element in the list for an exact match of the search term. Returns a string that reports the number of times the search term is found in the list.

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!