Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.,

   

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:

Step by Step Solution

3.50 Rating (153 Votes )

There are 3 Steps involved in it

Step: 1

To achieve this task you can follow these steps Create a function filterphonecalls that takes the sp... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

What are the strengths and weaknesses of arguments by analogy?

Answered: 1 week ago

Question

What are the attributes of a technical decision?

Answered: 1 week ago

Question

How do the two components of this theory work together?

Answered: 1 week ago