from collections import Counter def two_sum(nums, target): seen = {} for i, n in enumerate(nums): if target - n in seen: return seen[target - n], i seen[n] = i return None print(two_sum([2, 7, 11, 15], 9)) # (0, 1) print(Counter("mississippi").most_common(2)) # See the lesson README for what to try next. # Try changing the values above and run it again.