You can download this code by clicking the button below.
This code is now available for download.
This function takes a list of numbers and a target value, and returns a pair of numbers that sum up to the target value. If no such pair is found, it returns None.
Technology Stack : List, Dictionary
Code Type : Function
Code Difficulty : Intermediate
def sum_pairs(numbers, target):
seen = {}
for num in numbers:
if target - num in seen:
return (target - num, num)
seen[num] = True
return None