CoreChallenge 13 of 34

Two sum

Write two_sum(numbers, target) that returns the indices of the two numbers that add up to target, as a (i, j) with i < j. Assume exactly one answer exists. Aim for a single pass using a .

Examples
two_sum([2, 7, 11, 15], 9) → (0, 1)
Exercise

Two sum

3 checks
def two_sum(numbers, target):
    ...


print(two_sum([2, 7, 11, 15], 9))
 
Python (loads on first run)Ctrl+Enter runs
Output
Press Run to try your code, then Check answer to grade it.