Answered step by step
Verified Expert Solution
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started