def twoSum(arr,target):
for i in range(len(arr)-1):
for j in range(i+1,len(arr)):
if(arr[i]+arr[j]==target):
return([i,j])
else:
return("no indices found with that sum")
if __name__=="__main__":
arr=list(map(int,input().split()))
target=int(input())
print(twoSum(arr,target))
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
def twoSum(arr,target): for i in range(len(arr)-1): for j in range(i+1,len(arr)): if(arr[i]+arr[j]==target): return([i,j]) else: return("no indices found with that sum") if __name__=="__main__": arr=list(map(int,input().split())) target=int(input()) print(twoSum(arr,target))