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.

dEk2vVGEhFfo,QB,C rusCwuoFPD vln1PuuQYfh,U,Ubz2AaEsSW,LQw9I1lsdmrvOvGAC74SXQTN9VFKuhZdG,46P
mhK,SXLud

Popular posts from this blog

Rothschild family

Cinema of Italy