```
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
dict1={}
for i,v in enumerate(nums):
dict1[v]=i
for j in range(len(nums)):
t=target-nums[j]
if t in dict1 and dict1[t]!=j:
return [dict1[t],j]
```