Find all unique pairs in list that sum to target. Return list of tuples. Each pair is written as (smaller, larger), and the pairs come back in the order they are completed while scanning the list left to right.
Implement this function:
def find_pairs_with_sum(lst: list, target: int) -> 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, target.
Input
[1, 2, 3, 4]
5
Output
[(2, 3), (1, 4)]