Write a function check_sum(), which, given li, a list of integers, and num, returns whether any two numbers in li add up to num

Multi tool use
Multi tool use


Write a function check_sum(), which, given li, a list of integers, and num, returns whether any two numbers in li add up to num



Write a function check_sum(), which, given li, a list of integers, and num, returns whether any two numbers in li add up to num. There are no duplicates in li.
Provide a solution that is faster than O(n^2) time.


check_sum()


li


num


li


num


li



Example:


>>> check_sum(li=[11, 1, 2, 3, 10], num=21)
True
>>> check_sum(li=[11, 1, 2, 3], num=21)
False





That's a nice homework description. Now, what's your question?
– cricket_007
Jul 1 at 14:24









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

TZaa6I9qipGma,0FMzwh7l
bEk smsmnOMlX6B6k8nFttTotLYI9N2qK3hNK4CXq,VnU

Popular posts from this blog

Boo (programming language)

Rothschild family