Problem 1.
Write a function is_sorted_evenodd(L) that takes as input a list L of integers. The function returns (not print!) the Boolean value True if the list L is sorted as follows: the even elements appear in ascending order, and the odd elements appear in descending order. Otherwise, the function returns False.
Example:
A list with elements 13,−18,6,9,9,10,−17 is sorted as requested because the odd elements 13,9,9,−17 are descending, while the even elements −18,6,10 are ascending:Numbers 13 -18 6 9 9 10 -17, Parity odd even even odd odd even odd.
Your function should not use the in-build sort or sorted commands: checking whether or not a list is sorted does not require any sorting.
Problem 2.
Assume that L is a list of integers. Write a function even_slice(L, a, b) that returns a new list containing all the even numbers among the elments of L between indices a and b (including both of them) in their original order. The original list L should remain unchanged. You can assume that 0 <= a <= b < len(L).
Example:
even_slice([11, 12, 2, 17, 20, 22, 2, 19, 7, 42, 18, 20], 2, 10) should return [2,20,22,2,42,18]