1 def twoSum(nums, target): 2 d = {} 3 for i, num in enumerate(nums): 4 if target - num in d: 5 return (d[target-num], i) 6 d[num] = i