Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Anyone know how to do this using python? Define the get_most_recent) function which is passed two lists of numbers as parameters . a list of
Anyone know how to do this using python?
Define the get_most_recent) function which is passed two lists of numbers as parameters . a list of numbers which are in order from the least recent to the most recent, i.e., the number at the end of the list is the most recent, and . a list of numbers to test - the numbers of this list may or may not be elements of the first parameter list. This function returns the number from the "list of numbers to test" which occurred most recently in the first parameter list (i.e., is closer to the end of the list). If none of the numbers in the "numbers to test" list occurred in the first parameter list, the function should return -1. For example, the following code print("1.", get_most_recent ([, 1, 2, e, 3, 4, 1], [2, e, 3])) print("2.", get_most_recent ([, 1, 2, e, 3, 4, 1], [e, 7, 21)) print("3.", get_most_recent ([, 1, 2, 8, 9, , 3, 4, 6], [1, 9, 2, 8])) print("4.", get_most_recent ([4, 1, 4, 5, 4, 1], [e, 7, 3])) print("5.", get_most recent ([8, 1, 2, , 8, 4, 1], [8, 7, 3])) print("6.", get_most recent (, [8, 1, , 3])) numbers-in-order [1, 1, 1, 9, 1, 0, 2, 2, 1, 2, 0, 1, 2, 9, 3, 4, 1, 2, 4, 0, 3, 8, 8, 5, 5] print("7.", get_most_recent(numbers_in_order, [1, 8, 3, 41)) numbers_in_order [1, 2, 2, 2, 2, 3, 1, 3, 8, 8] print("8.", get_most_recent(numbers_in_order, [1, 8, 2, 3, 4, 2])) prints 1. 3 2. e 3. 9 5. 8 7. 3 8. 8Step 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