Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me implement discover_violations function. I have included the list_weather_violations function also. 34. Implement discover_violations On its surface looks just like However, there are
Please help me implement discover_violations function. I have included the list_weather_violations function also.
34. Implement discover_violations On its surface looks just like However, there are three important differences. First of all, prints out the number of violations found to the screen. Second, if the argument is the name of a CSV file, it writes all of the violations found to that file. Finally, if you choose to do any of the optional activities, will eventually include the violations found there as well. Writing the CSV file is easy; there is a function for that in When writing the code for the print statements, pay close attention to the specification. Remember the period. Notice what to do if no violations are found. And remember to use the singular "violation" if only one violation is found. Implement this function as specified and run the test script. If you have done everything correctly, you should see the following: Testing module app (this may take a while) app.discover_violations passed all tests fiscover_violations(directory, output): "I" Searches the dataset directory for any flight lessons the violation regulations. This function will call list_weather_violations() to get the list of weather violatio If list_endorsment_violations (optional) is completed, it will call that too, as well as list_inspection_violations. It will concatenate all of these 2d lists into a single 2d list of violations (so a flight may be listed more than once for each of the three types of violations). If the parameter output is not None, it will create the CSV file with name output and write the 2d list of violations to this file. This cSV file should have the following header: STUDENT, AIRPLANE, INSTRUCTOR, TAKEOFF, LANDING, FILED, AREA, REASON Regardless of whether output is None, this function will print out the number of violations, as follows: '23 violations found.' If no violations are found, it will say 'No violations found.' Parameter directory: The directory of files to audit Precondition: directory is the name of a directory containing the files 'daycycle.jso 'weather.json', 'minimums.csv', 'students.csv', 'teachers.csv', 'lessons.csv', 'fleet. csv', and 'repairs. csv'. Parameter output: The CSV file to store the results Precondition: output is None or a string that is a valid file name ""I
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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