1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Korolek [52]
3 years ago
11

Implement the function pairSum that takes as parameters a list of distinct integers and a target value n and prints the indices

of all pairs of values in the list 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
Computers and Technology
1 answer:
Yuki888 [10]3 years ago
6 0

Answer:

Following are the code to this question:

def pairSum(a,x): #find size of list

   s=len(a) # use length function to calculte length of list and store in s variable

   for x1 in range(0, s):  #outer loop to count all list value

       for x2 in range(x1+1, s):    #inner loop

           if a[x1] + a[x2] == x:    #condition check

               print(x1," ",x2) #print value of loop x1 and x2  

pairSum([12,7,8,6,1,13],13) #calling pairSum method

Output:

0   4

1   3

Explanation:

Description of the above python can be described as follows:

  • In the above code, a method pairSum is declared, which accepts two-parameter, which is "a and x". Inside the method "s" variable is declared that uses the "len" method, which stores the length of "a" in the "s" variable.
  • In the next line, two for loop is declared, in the first loop, it counts all variable position, inside the loop another loop is used that calculates the next value and inside a condition is defined, that matches list and x variable value. if the condition is true it will print loop value.
You might be interested in
On hearing my name, you may think that I am iterative, but I play a vital role in networking by boosting the signal strength to
natka813 [3]

Answer:

A Repeater

Explanation:

A Repeater takes a signal, and then repeats it - in order to boost it.

Iteration is also the repetition of something, which sounds like what a repeater would do.

4 0
2 years ago
Pie charts are best used for
Anna11 [10]

Answer:B

Explanation:Showing parts of a whole.

4 0
2 years ago
6. At age 17, what was Minhaj's definition of the American Dream?
marta [7]
“To me being American means having the opportunity to reach for our goals. It’s accepting where we come from while embracing our dreams and where we’re headed. It’s what makes America great.”
3 0
3 years ago
What does FTTB mean?
EleoNora [17]

  • <em><u>Fiber to the building</u></em>

Explanation:

  • <em><u>Fiber to the building</u></em><em><u> </u></em><em>is a type of fiber-optic cable installation where the fiber cable goes to a point on a shared property and the other cabling provides the connection to single homes, offices or other spaces.</em>

<h2><em>hope </em><em>it</em><em> helps</em><em>!</em></h2>
3 0
2 years ago
Which symbol is at the beginning and end of a multiline comment block? &amp;&amp;&amp; """ %%% ###
yawa3891 [41]

Answer:

#

Explanation:

I have notes on it we learned it in 8th

7 0
3 years ago
Other questions:
  • .____________ is a way to identify and differentiate goods andservices through use of a name or distinctive design element.
    10·1 answer
  • Which device makes computers that are connected to separate segments appear and behave as if they're on the same segment? (Pleas
    11·1 answer
  • 2. Integer plot function (find a smart way to code big integers) Write a program BigInt(n) that displays an arbitrary positive i
    8·1 answer
  • Suppose that a computer can read or write a memory word in 5 nsec. Also suppose that when an interrupt occurs, all 32 CPU regist
    10·2 answers
  • What are the differences between tkinter toolkit and PyQt?
    14·1 answer
  • Look at the network topology. What will happen with the other computers if the computer breaks at the RED X?
    8·1 answer
  • Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyram
    6·2 answers
  • Which type of computer is used to process large amount of data​
    15·2 answers
  • The full meaning of UNIVAC and ENIAC​
    5·2 answers
  • Dynamics
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!