Your task will be to select the lines that have the phone numbers with the 412...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Your task will be to select the lines that have the phone numbers with the 412 area code and timestamps between midnight (included), i.e., 00:00:00 and 6 am (not included), i.e. 05:59:59. By inspecting the task3.py file you confirm that this time no scaffolding code is provided. You will have to write 100% of the code to solve the problem yourself. Iterate Over the File Line by Line As the first step, implement a function that reads the file and prints it to the terminal one line at a time. Start your work by creating the filter_phone_calls function with the following parameters: area_code: An int indicating the focused area code. . . . start_hour: An int between 0 and 24 indicating the starting hour of the focused time span. end_hour: An int between 0 and 24 indicating the finishing hour of the focused time span. input_path: A str identifying the file from which the input should be read. output_path: A str identifying the file to which the output should be written. Within the function, open the input_path file for reading, preferably using the with statement. Read the file line by line and print the lines to your terminal. Validate your work by printing the lines to the terminal. filter_phone_calls( area_code=000, # not used at this point start_hour=-1, # not used at this point end_hour=-1, # not used at this point input_path='data/phone_calls.txt', output_path=None # not at this point > It might take a while to complete printing to the terminal. You should observe an output that begins and ends like this: Your task will be to select the lines that have the phone numbers with the 412 area code and timestamps between midnight (included), i.e., 00:00:00 and 6 am (not included), i.e. 05:59:59. By inspecting the task3.py file you confirm that this time no scaffolding code is provided. You will have to write 100% of the code to solve the problem yourself. Iterate Over the File Line by Line As the first step, implement a function that reads the file and prints it to the terminal one line at a time. Start your work by creating the filter_phone_calls function with the following parameters: area_code: An int indicating the focused area code. . . . start_hour: An int between 0 and 24 indicating the starting hour of the focused time span. end_hour: An int between 0 and 24 indicating the finishing hour of the focused time span. input_path: A str identifying the file from which the input should be read. output_path: A str identifying the file to which the output should be written. Within the function, open the input_path file for reading, preferably using the with statement. Read the file line by line and print the lines to your terminal. Validate your work by printing the lines to the terminal. filter_phone_calls( area_code=000, # not used at this point start_hour=-1, # not used at this point end_hour=-1, # not used at this point input_path='data/phone_calls.txt', output_path=None # not at this point > It might take a while to complete printing to the terminal. You should observe an output that begins and ends like this:
Expert Answer:
Answer rating: 100% (QA)
To achieve this task you can follow these steps Create a function filterphonecalls that takes the sp... View the full 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 programming questions
-
Taking the jumping probability = = 0.3, compute PageRank for the graph below. 2
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
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...
-
Below is the article related to the funding and construction of the SD Padres' ballpark in downtown San Diego. The article below relates to the Padres' decision to incur substantial payoff...
-
A 10-kg block is attached to spring A and connected to spring B by a cord and pulley. The block is held in the position shown with spring A stretched 25 mm and spring B unstretched when the support...
-
On January 1, 20X1, Figland Company purchased for cash 40% of Irene Companys 300,000 shares of voting common stock for $1,800,000. At the time, 40% of the book value of the underlying equity in...
-
Two key performance indicators for a company are profitability and solvency. Why are these so important? Is the value of accrual accounting more evident when centered on profitability or solvency?
-
Hinske Company had the following transactions during April. 1. Sold merchandise on account. 2. Purchased merchandise on account. 3. Collected cash from a sale to Renfro Company. 4. Recorded accrued...
-
Assume you have $1 million Cash and are trying to choose among three securities to invest. a . Security A is a price weighted index of the following three stocks with the corresponding price...
-
The Stratton Township Park is located on a piece of property that contains two golf courses, a swimming pool, and 800 acres of woods and open spaces. Three years ago, the Stratton Park Department...
-
Suppose that you are thinking about investing in a 6-year, 10% annual coupon bond issued by the Justin Reid, Corp. (JRC) and the bonds have a required rate of return of 10%. The bonds require JRC to...
-
4) There are 125 students enrolled in statistics at CCC this semester. The math department wants to take a simple random sample (SRS) of 10 of those students. How may the department accomplish this
-
The portfolio steering committee is considering selecting Project A. The committee expects the project will produce a one-time benefit of 2.5 Million Dollars three years from now. The interest rate...
-
When Cramer's Rule is used to solve a 2 x 2 linear system by using determinants to find x and y as:x = frac ( sub ( D , x ) , D ) , y = frac ( sub ( D , y ) , D ) and D = 0 , then the system is...
-
If you are 29 miles due west of Denver and your friend is 20 miles due north of Denver, what is the shortest distance from your friend to you ?
-
The conduction velocity of an unmyelinated neuron is 2 metres/second (m/s), while the velocity in a myelinated neutron is 120 m/s. how many milliseconds (ms) would it take for a nerve impulse to...
-
26) Which of the following accounts will be closed by debiting the Income Summary account? A) Depreciation Expense B) Accounts Payable C) Service Revenue D) Accumulated Depreciation 27) Which of the...
-
Starr Co. had sales revenue of $540,000 in 2014. Other items recorded during the year were: Cost of goods sold ..................................................... $330,000 Salaries and wages...
-
Clifford Johnson has a limited partnership investment and a rental condominium. Clifford actively manages the rental condominium. During 2012, his share of the loss from the limited partnership was...
-
Mike purchases a heavy-duty truck (5-year class recovery property) for his delivery service on April 30, 2012. The truck is not considered a passenger automobile for purposes of the listed property...
-
a. Wilson filed his individual tax return on the original due date, but failed to pay $700 in taxes that were due with the return. If Wilson pays the taxes exactly 2 months late, calculate the amount...
-
The pocket of hot air appears to be a pool of water because A. Light reflects at the boundary between the hot and cool air. B. Its density is close to that of water. C. Light refracts at the boundary...
-
Which of these changes would allow you to get closer to the mirage before it vanishes? A. Making the pocket of hot air nearer in temperature to the air above it B. Looking for the mirage on a windy...
-
If you could clearly see the image of an object that was reflected by a mirage, the image would appear A. Magnified. B. With up and down reversed. C. Farther away than the object. D. With right and...
Study smarter with the SolutionInn App