def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ dict = {} result = [] for i in range(len(nums)): dict[nums[i]]= i print(dict) for i in range(len(nums)): if (dict.get(target-nums[i]) != None) & (dict[target-nums[i]] != i ): print(i) result.append(i) result.append(dict.get(target-nums[i])) break return result