def maxPairSum(lst): if lst[0] > lst[1]: top, top2 = lst[:2] else: top2, top = lst[:2] for i in range(2, len(lst)): if lst[i] > top: top, top2 = lst[i], top elif lst[i] > top2: top2 = lst[i] return top+top2