Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 5 . Implement ratings / endorsements ( OPTIONAL ) The next three functions has _ instrument _ rating, has _ advanced _ endorsement, has
Implement ratingsendorsements OPTIONAL
The next three functions hasinstrumentrating, hasadvancedendorsement, hasmultiengineendorsement are completely optional. They will be used later by some sections of the project that are optional. You can code them now or you can choose to skip these for now and circle back to them later if you decide to work on the optional sections that depend on them. These functions are not necessary to complete this part of the project, and they will not be checked on submission. You can even work on this part of the project after the course is over, provided you copy these instructions.
These functions have to do with ratings what conditions the pilot can fly in and endorsements what types of planes the pilot can fly These are extremely short functions and can be computed in two or three lines. You simply need to look at the takeoff time and compare it to the appropriate column for the student. As a reminder, the argument student is not a table of students but a single row of the table.
Implement these functions as specified and run the test script. If you have done everything correctly, you should see the following:
Testing module pilots
pilots.getcertification passed all tests
pilots.hasinstrumentrating passed all tests
pilots.hasadvancedendorsement passed all tests
pilots.hasmultiengineendorsement passed all tests
Check It
def hasadvancedendorsementtakeoffstudent:
OPTIONAL
Returns True if the student has an endorsement to fly an advanced plane at the time of takeoff.
The function returns False otherwise.
Recall that a student is a element list of strings. The first three elements are
the student's identifier, last name, and first name. The remaining elements are all
timestamps indicating the following in order: time joining the school, time of first
solo, time of private license, time of hours certification, time of instrument
rating, time of advanced endorsement, and time of multiengine endorsement.
Parameter takeoff: The takeoff time of this flight
Precondition: takeoff is a datetime object
Parameter student: The student pilot
Precondition: student is element list of strings representing a pilot
pass
def hasmultiengineendorsementtakeoffstudent:
OPTIONAL
Returns True if the student has an endorsement to fly an multiengine plane at the time of takeoff.
The function returns False otherwise.
Recall that a student is a element list of strings. The first three elements are
the student's identifier, last name, and first name. The remaining elements are all
timestamps indicating the following in order: time joining the school, time of first
solo, time of private license, time of hours certification, time of instrument
rating, time of advanced endorsement, and time of multiengine endorsement.
Parameter takeoff: The takeoff time of this flight
Precondition: takeoff is a datetime object
Parameter student: The student pilot
Precondition: student is element list of strings representing a pilot
pass
def getbestvaluedata index, maximumTrue:
Returns the 'best' value from a given column in a dimensional nested list.
This function is a helper function for getminimums whose docstring you should
read and understand first
The data parameter is a dimensional nested list of data. The index parameter
indicates which "colummn" of data should be evaluated. Each item in that column
is expected to be a number in string format. Each item should be evaluated as a
float and the best value selected as the return value for the function. The
best value is determined by the maximum parameter and is either the highest or
lowest float value.
The D list does not include a header row. It should not be modified in any way.
Parameter data: a dimensional nested list of data
Precondition: the column referenced by index should by numbers in string format
Parameter index: position to examine in each row of data
Precondition: index is a an integer
Parameter maximum: indicates whether to return the highest value True or
lowest value False
Precondition: maximum is a boolean and defaults to True
# Find the best values for each column of the row
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