Question: def write _ csv ( data , filename ) : Writes the given data out as a CSV file filename. To be
def writecsvdatafilename:
Writes the given data out as a CSV file filename.
To be a proper CSV file, data must be a dimensional list with the first row
containing only strings. All other rows may be any Python value. Dates are
converted using ISO formatting. All other objects are converted to their string
representation.
Parameter data: The Python value to encode as a CSV file
Precondition: data is a dimensional list of strings
Parameter filename: The file to read
Precondition: filename is a string representing a path to a file with extension
csv or CSV The file may or may not exist.
file openfilenamew newline
writer csvwriterfile
writer.writerowsdata
file.close
def discoverviolationsdirectoryoutput:
Searches the dataset directory for any flight lessons the violation regulations.
This function will call listweatherviolations to get the list of weather violations.
If listendorsmentviolations optional is completed, it will call that too, as
well as listinspectionviolations. It will concatenate all of these d lists
into a single d 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 d 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:
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.json',
'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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
