Question 1
Write a function extract_middle_elements(lst) that takes a non-empty list and returns a list with its middle element, if the length of lst is odd, or with its two middle elements, in their order, if the length is even.
NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.
Example
extract_middle_elements([7, 8, 9, 10, 11, 12, 13]) -> [10]
extract_middle_elements([3, 6, 9, 12, 15, 18]) -> [9, 12]
Your task
Implement this function:
def extract_middle_elements(lst: list) -> list:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: lst.
Example
Input
[7, 8, 9, 10, 11, 12, 13]
Output
[10]