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.
extract_middle_elements([7, 8, 9, 10, 11, 12, 13]) -> [10]
extract_middle_elements([3, 6, 9, 12, 15, 18]) -> [9, 12]
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.
Input
[7, 8, 9, 10, 11, 12, 13]
Output
[10]
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: ```python 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] ``` The string `sentence` has exactly three words, separated by single spaces. The tuple `order` is a permutation of `0, 1, 2`. Write a function `shuffle_sentence(sentence, order)` that returns the sentence with its words put in the order given by `order`: the first word of the result is the word of `sentence` whose index is `order[0]`, and so on. 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 ``` shuffle_sentence("apple banana orange", (0, 2, 1)) -> 'apple orange banana' shuffle_sentence("cat dog mouse", (2, 1, 0)) -> 'mouse dog cat' ``` ## Your task Implement this function: ```python def shuffle_sentence(sentence: str, order: tuple) -> str: ``` 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: `sentence`, `order`. ## Example **Input** ``` "apple banana orange" (0, 2, 1) ``` **Output** ``` 'apple orange banana' ``` Write a function `same_sign(a, b)` that returns `True` if both numbers are positive, or both are negative, or both are zero. Otherwise it returns `False`. 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 ``` same_sign(10, 20) -> True same_sign(-5, -15) -> True ``` ## Your task Implement this function: ```python def same_sign(a, b) -> bool: ``` 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: `a`, `b`. ## Example **Input** ``` 10 20 ``` **Output** ``` True ```