Using the existing code to add additional cleaning logic to the clean_phone_numbers() function. Original Requirements 1. clean_phone_numbers
Fantastic news! We've Found the answer you've been seeking!
Question:
Using the existing code to add additional cleaning logic to the clean_phone_numbers() function.
Below is the code to build upon:
Transcribed Image Text:
index.py index.py > ... 1 import phoney 2 import csv 3 4 5 6 7 8 9 10 11 12 13 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 X phoney.py 49 50 51 52 53 def present_menu(): This function presents a menu of options to the user and continues to request input until valid input is found. The function then returns the selection. while True: selection = input ("Enter F to search for full phone number, A to search for area code, E to search for exchange, or X to exit: ").upper() if selection in ['F', 'A', 'E', 'X']: return selection def main(): phone_numbers.csv filename= 'phone_numbers.csv' phone_numbers = [] with open('phone_numbers.csv', 'r') as f: reader = csv.reader (f) for row in reader: phone_numbers.extend(row) #print (phone_numbers) print (f"There were (len (phone_numbers)} numbers in the original list.") clean_numbers = phoney.clean_phone_numbers (phone_numbers) print (clean_numbers) continueLoop = True while continueLoop: selection = present_menu() selection.upper () if selection == 'F' search_term= input("Enter a search term: ") full_phone, full_phone_counter = phoney.find_number(clean_numbers, search_term) print (full_phone, full_phone_counter) elif selection == 'A': search_term = input("Enter a search term: ") area_phone, area_phone_counter = phoney.find_areacode (clean_numbers, search_term) print(area_phone, area_phone_counter) KANNA elif selection == 'E': ( search term= input("Enter a search term: ") exchange_phone, exchange_phone_counter = phoney.find_exchange (clean_numbers, search_term) print (exchange_phone, exchange_phone_counter) elif selection == 'X': continueLoop = False if name == ___main__": main() index.py index.py > ... 1 import phoney 2 import csv 3 4 5 6 7 8 9 10 11 12 13 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 X phoney.py 49 50 51 52 53 def present_menu(): This function presents a menu of options to the user and continues to request input until valid input is found. The function then returns the selection. while True: selection = input ("Enter F to search for full phone number, A to search for area code, E to search for exchange, or X to exit: ").upper() if selection in ['F', 'A', 'E', 'X']: return selection def main(): phone_numbers.csv filename= 'phone_numbers.csv' phone_numbers = [] with open('phone_numbers.csv', 'r') as f: reader = csv.reader (f) for row in reader: phone_numbers.extend(row) #print (phone_numbers) print (f"There were (len (phone_numbers)} numbers in the original list.") clean_numbers = phoney.clean_phone_numbers (phone_numbers) print (clean_numbers) continueLoop = True while continueLoop: selection = present_menu() selection.upper () if selection == 'F' search_term= input("Enter a search term: ") full_phone, full_phone_counter = phoney.find_number(clean_numbers, search_term) print (full_phone, full_phone_counter) elif selection == 'A': search_term = input("Enter a search term: ") area_phone, area_phone_counter = phoney.find_areacode (clean_numbers, search_term) print(area_phone, area_phone_counter) KANNA elif selection == 'E': ( search term= input("Enter a search term: ") exchange_phone, exchange_phone_counter = phoney.find_exchange (clean_numbers, search_term) print (exchange_phone, exchange_phone_counter) elif selection == 'X': continueLoop = False if name == ___main__": main()
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these algorithms questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
(7b-4c-1)-2 (2b3c-2)5 Simplify.
-
As of January 1, 2017, the trial balance for Haven Hospital was as follows: During the fiscal year ended December 31, 2017, the following transactions occurred: 1. Patient service revenue amounted to...
-
Assume the annual price data below is for General Foods and the S&P 500, covering the period 19972012. Calculate the beta for General Foods. Use the ESTLIN function or the SLOPE function in the...
-
How do animals obtain nutrients?
-
T. J. Carlin has the following transactions during August of the current year. Indicate (a) The effect on the accounting equation and (b) The debit-credit analysis illustrated on pages 6166 of the...
-
1. (a) A person first walks at a speed of 2.0 m/s, then at 6.0 m/s for an equal distance. Find the average velocity. (4 pts) (b) A rock is dropped (from rest) from the top of a 75-m-tall building....
-
In early 2016, Doc and Lyn McGee formed the McGee Cake Company. The company produced a full line of cakes, and its specialties included chess cake,* lemon pound cake, and double-iced, double...
-
Monies earned by foreign subsidiaries that have not yet been taxed under U.S. law can be used to: purchase U.S. government bonds. purchase U.S. stocks. pay dividends. invest in new capital overseas....
-
Joan is a title examiner. After she performs a title search and title examination, she will prepare the: title commitment stating the requirements to close the transaction owner's title insurance...
-
What additional thoughts or insight did you gain during your reading from Educational Leadership: A Bridge to Improved Practice, Lincoln Speaks to Leaders, and Insights into Action texts? Please...
-
We find we have less inventory physically on hand than our records indicate we should have Question 24 options: Estimates Invoice Receive payment Sales receipt Bank deposit Credit memo Refund receipt...
-
Mr. Johnson has 2 medical insurance policies. To prevent duplication of payment for the same medical expense, the policies include a Question 7 options: coordination of benefits statement....
-
Assignment of benefits is Question 20 options: the transfer of one's legal right to collect an amount payable under an insurance contract. used only by non-par physicians. the transfer of the...
-
2. Shoreline Park in Mountain View, California, has kept close tabs on the number of patrons using the park since its opening in January 1993. For the first six months of operation, the following...
-
An item of depreciable machinery was acquired on 1 July 2009 for $120,000 by cash It is expected to have a useful life of 10 years and zero salvage value On 1 July 2012, it was decided to revalue the...
-
Jason and Mary Wells, friends of yours, were married on December 30, 2012. They know you are studying taxes and have come to you with a question concerning their filing status. Jason and Mary would...
-
Leslie is a single taxpayer who is under age 65 and in good health. For 2012, she has a salary of $23,000 and itemized deductions of $1,000. Leslie is entitled to one exemption on her tax return. a....
-
Jenny earns $34,500 in 2012. Calculate the FICA tax that must be paid by: Jenny: ..............................Soc,Sec. ..................$______________...
-
(a) The longitudinal data set "v4c" is in the vertical format; transform it into the horizontal format. (b) Transform the data set you obtained in part (a) back into the vertical format.
-
Perform some exploratory analysis on the DTS study described above. (a) Compute the mean and standard deviation of the HamD scores for the two treatment groups at each time point. (b) Treat repeated...
-
For the DTS study, use subjects with all five assessments in HamD scores in the CAU group for this question. The intraclass correlation coefficient among the repeated measures in Ham-D scores can be...
Study smarter with the SolutionInn App