Final answer:
The function get_largest_even is to be completed by using filter to get a list of even numbers and then functools.reduce to find the largest number among them. The correct implementation returns the largest even number from the given list.
Step-by-step explanation:
The student is asking for help with a Python function that needs to be completed. The function, get_largest_even, should take a list of numbers and return the largest even number using functional programming techniques. The partial code provided seems to contain placeholders for filtering even numbers and reducing to find the largest value.
To implement the function, you need to use filter to make a new list of even numbers (new_lst), and then apply functools.reduce to find the largest number in that new list. Here is the completed function:
import functools
def get_largest_even(lst):
new_lst = list(filter(lambda n: n % 2 == 0, lst))
return functools.reduce(lambda a, b: a if a > b else b, new_lst)
You can call this function with a list of numbers, and it will return the largest even number, as in the provided example with get_largest_even([5, -1, 12, 10, 2, 8]) which would correctly return 12.