You can download this code by clicking the button below.
This code is now available for download.
Find all pairs of numbers in a list that sum up to a specific value. If such pairs exist, return them; otherwise, return None.
Technology Stack : List, Dictionary
Code Type : Function
Code Difficulty : Intermediate
def a_sum_pairs(numbers, target):
seen = {}
for num in numbers:
if target - num in seen:
return num, target - num
seen[num] = True
return None, None