Question: python only List the eligible drivers a function listRoadTests that determines which requests are eligible to proceed taking the road test using the isEligible function

python only

List the eligible drivers

a function listRoadTests that determines which requests are eligible to proceed taking the road test using the isEligible function created in Part 1, and returns a list of eligible drivers information following the template below:

is allowed to take the road test.

For example, "John" with license class "G1" and 14 months experience wishes to take the "G2" road test, John's information would be included in the returning list as a string formatted to John is allowed to take the G2 road test. The returning list will only contain the information about those eligible to take the road test they applied for.

Your function should:

Receive 4 arguments:

people: a list of String values with names of the drivers

license: a list of String values with the driver's current class

period: a list of Integer values with duration in months that the person has held their current license for

applied: a list of String values with the class the driver is applying for

For each person in the list, check if they are eligible to take the road test they applied for using the isEligible function from part 1.

For a eligible drivers, you will insert their formatted information into a list (that will be returned by the function)

Returns a list of String values

This list will include only the information of eligible drivers using the format given in this part 2.

all your arguments are lists that have respective information of a given driver at the same list position. For example, ["John", "Arya"], ["G1", "G2"], [16, 28], ["G", "G"] you can interpret that John has a G1 license for 16 months and is applying to take a G class road test; and that Arya has a G2 license for 28 months and is applying to take a G class road test. See the first test case to find out the resulting list.

Also, please provide 5 extra test cases like the ones shown:

[ ]:

# Your solution

[19]:

 
# Test Cases -- uncomment to run
# each for-loop calls the function from part 2 and prints the elements in their resulting lists
# print("Test 1---")
# for result in listRoadTests(["John", "Arya"], ["G1", "G2"], [16, 28], ["G", "G"]):
# print(result) # expected only 1 result: Arya's information
# print("Test 2---")
# for result in listRoadTests(["Claire", "Jammie"], ["G1", "G2"], [14, 26], ["G2", "G"]):
# print(result) # expected 2 results: Claire and Jammie's information
# print("Test 3---")
# for result in listRoadTests(["Claire", "Jammie", "John", "Arya"], ["G1", "G2", "G", "G2"], [14, 16, 18, 33], ["G1", "G", "G2","G"]):
# print(result) # expected only 1 result: Arya's information
# print("Test 4---")
# for result in listRoadTests(["Claire", "Jammie", "John", "Arya"], ["G1", "G2", "G1", "G2"], [14, 27, 24, 33], ["G2", "G", "G2","G"]):
# print(result) # expected 4 results: Claire, Jammie, John, and Arya's information
 
 
# Your test cases

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!