Skip to content

Instantly share code, notes, and snippets.

@animatedlew
Created December 19, 2017 01:35
Show Gist options
  • Save animatedlew/aaa690ab6ee8f7f52cb23e3e33ab2f4d to your computer and use it in GitHub Desktop.
Save animatedlew/aaa690ab6ee8f7f52cb23e3e33ab2f4d to your computer and use it in GitHub Desktop.
def get_total_pairs(nums, total):
return [(x, y) for y in nums for x in nums if x + y == total]
if __name__ == '__main__':
print(get_total_pairs([1, 2, 3, 4, 5, 6, 7, 8, 9], 10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment