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
Out-of-order instruction execution can cause problems because a later instruction may depend on the results from an earlier inst
scoundrel [369]

Answer:

C

Explanation:

6 0
2 years ago
What does the Autosum feature on excel do?
BabaBlast [244]
The answer is 1. Pressing the Autosum button highlights the ten cells above it so that you can easily add things together. Hope this helps!
8 0
3 years ago
The text between and defines the _____.
Genrish500 [490]
Active text on a page
5 0
2 years ago
Please do this now
Ber [7]

here are some ideas

some things i wished i knew before coming into middle school:

1. be organized

2. dont worry about other peoples opinions

3. DO YOUR HOMEWORK

things you learned so far:

1. a lot of things...

2. take notes

3.people change

advice:

if you stress too much, it gets hard.

its okay to get a bad grade on an assignment every once and a while.

be flexable with the people around you

TAKE DEEP BREATHS

DONT TALK DURING CLASS

going into the next grade:

i would change my dynamics and sleeping habits

so there are some ideas that i hope will help!!!

8 0
2 years ago
Deirdre has a hearing disability. One of her friends advised her to use real-time text or RTT on her phone. In which of these
ozzi

The way that real-time text or RTT on her phone can help her is that;

C: On phone calls, it will convert speech into text

<h3>Speech to Text</h3>

We are told that Deirdre has a hearing disability. This means that she has difficulty in hearing words clearly but can read.

Thus, from her friends advice about real time text or RTT, it will aid her because whenever someone calls her on the phone, it can convert the content of the call speech into text.

The missing options are;

A. It will make her phone vibrate to notify her when she gets a phone call

B. It will make her phone vibrate to notify her when she gets a text message.

C. On phone calls, it will convert speech into text. D. While text messaging, it will convert text into speech

Read more on speech to text at; brainly.com/question/2375490

5 0
2 years ago
Other questions:
  • Aubrey didnt like to use graphics or images on her slides. She preferred to use only a title for her slides and bullet-poinged t
    14·2 answers
  • Jason is working on a project that requires him to manage a huge amount of data. The spreadsheet he is working on has data relat
    12·1 answer
  • How to reply to text from unknown number?
    11·1 answer
  • A computer can sort x objects in t seconds, as modeled by the function below:
    5·1 answer
  • When an interrogator speaks highly about how a crime was committed, hoping to get the suspect to brag about his or her involveme
    7·2 answers
  • What does input allow a computer to do
    14·1 answer
  • What defines the scope of a project?
    5·1 answer
  • Lab 8-1: Working with Boot Loader and Runlevels what is the root password
    9·1 answer
  • Data elements in a relational database are organized into ____
    15·1 answer
  • Windows 8 uses a(n) ________ account for easy access and storage of online files.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!