Write a function list_mutating_operations(items, item1, item2) that applies the
following operations to items in place, in this exact order. Do not build a
new list anywhere -- every step must modify items itself.
items in ascending order.item1 at the end.item2 at index 3.items with the first three elements of items (as it is at that moment).popped_item; otherwise popped_item is None.item2 is present in the list, remove its first occurrence.None.0, 2, 4, ...) to None.Return the tuple (items, popped_item).
Example
list_mutating_operations([5, 3, 9, 1, 7], 10, 3) -> ([5, 9, None], 7)
Implement this function:
def list_mutating_operations(items: list, item1, item2) -> tuple:
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: items, item1, item2.
Input
[5, 3, 9, 1, 7]
10
3
Output
([5, 9, None], 7)