Question: IN PYTHON Using nested loops, implement the function pairSum () that takes as parameters a list of distinct integers lst and a target value n
IN PYTHON
Using nested loops, implement the function pairSum() that takes as parameters a list of distinct integers lst and a target value n and prints the indices of all pairs of values in lst that sum up to n. If there are no pairs that sum up to n, the function should not print anything. Note that the function does not duplicate pairs of indices. The information below shows how you would call the function and what it would display for several examples:
, python 3.7.0 Shell File Edit Shell Debug Options Window Help Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD6 ) on win32 Type "copyright", "credits" or "license )" for more information. 2 2 RESTART: C:/Users/eve/Documents/evelyn/241/Text/ch05/1ab7.py >>>pairSum ([7, 8, 5, 3, 4, 6], 11) 0 4 1 3 2 5 >>>pairSum (17, 8, 5, 3, 4, 6], 10) 0 3 4 5 >>>pairSum (11, 3, , 7], 13) 2 3 5 >>>pairSum ([1, , , 7], 10) 1 3 lc1's Ct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
