n=len(nums)
for i in range(0,n):
m=targetnums[i]
if m in nums:
q=nums.index(m)
if i!=q:
break
return [i,q]
8 lines python solution


@lil It is assumed that each input would have exactly one solution. Thus, I think there should be only one output and we can ignore the case that nums[i] appears more than once :)