Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 5 . Implement ratings / endorsements ( OPTIONAL ) The next three functions has _ instrument _ rating, has _ advanced _ endorsement, has

15. Implement ratings/endorsements (OPTIONAL)
The next three functions has_instrument_rating, has_advanced_endorsement, has_multiengine_endorsement 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 take-off 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.get_certification passed all tests
pilots.has_instrument_rating passed all tests
pilots.has_advanced_endorsement passed all tests
pilots.has_multiengine_endorsement passed all tests
Check It!
def has_advanced_endorsement(takeoff,student):
"""
(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 10-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 50 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 10-element list of strings representing a pilot
"""
pass
def has_multiengine_endorsement(takeoff,student):
"""
(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 10-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 50 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 10-element list of strings representing a pilot
"""
pass
def get_best_value(data, index, maximum=True):
"""
Returns the 'best' value from a given column in a 2-dimensional nested list.
This function is a helper function for get_minimums (whose docstring you should
read and understand first).
The data parameter is a 2-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 2D list does not include a header row. It should not be modified in any way.
Parameter data: a 2-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

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions