Question: Python!! Write a function, called addsToK, that given an integer k and a list of n integers A, determines if there is a pair of

Python!!

Write a function, called addsToK, that given an integer k and a list of n integers A, determines if there is a pair of mutually distinct integers in A that add up to k. Returns True if they are, False otherwise. Try to solve this problem by leveraging the various qualities of a dictionary.

For example : given [1, 6, 7, 3, 7, 10, 3] if k=13 then there is a pair of integers that add up to 13 : 10 and 3. If k=14 then there isnt a pair of distinct integers that add up to 14 (cant use 7 twice even if it appears twice in the list)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!