Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . You must use at least one list comprehension in your phoney module ( but you may use more than one ) 2 .

1. You must use at least one list comprehension in your phoney module (but you may use more than one)
2. Your phoney module should include the type/code hinting that specifies the expected data type for your function arguments.
3. Each function in your phoney module must also include a docstring that provides a brief overview of its functionality.
Getting Started
1. Create a new directory named phoney_module_v1 inside your local root folder for this course.
2. Write your code in the phoney.py and index.py files inside the phoney_module_v1 directory.
3. You should be able to run your program by typing python index.py from the command line while you are in your phoney_module_v1 directory.
Instructions
Functions in the phoney Module:
1. 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
2. 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.
3. 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.
4. 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.
Instructions for index.py
1. Create a function named present_menu() that presents a menu of options to the user and continues to request input until valid input is found. The function then returns the selection.
Menu options should include:
F: Search for full phone number
A: Search for area code
E: Search for exchange
X: Exit the program
2. In the main() function:
Import the phone_numbers.csv file and read the contents into a 1-dimensional list
Pass the list of phone numbers to phoney.clean_phone_numbers to obtain a list of "clean" phone numbers
Report the results of the cleaning function to the user
Start a loop
o Ask the user for a menu selection by calling present_menu()
o If the user enters X, quit the program
o If the user chooses another option, ask the user to input a search term
Invoke the appropriate function in the phoney module and pass it the list of clean phone numbers and the user's search term
Report the results of the search function
o Restart the loop (ask the user for a new menu selection)
Hints
Although we think of phone numbers as "numbers", your program will work much more smoothly if you treat them as strings that contain digits (not "numbers")
Submission Instructions
To submit, zip the following files and attach A SINGLE ZIP FILE to Canvas:

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

Describe three ways to improve network performance on circuits.

Answered: 1 week ago

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago