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
- Consider the relation R = {A, B, C, D, E, F, G, H, I, J} and the set of functional dependencies F = { {B, C} -> {D}, {B} -&
Olenka [21]

Answer:

The key of R is {A, B}

Explanation:

A key can be seen as a minimal set of attributes whose closure includes all the attributes in R.

Given that the closure of {A, B}, {A, B}+ = R, one key of R is {A, B} But in this case, it is the only key.

In order for us to to normalize R intuitively into 2NF then 3NF, we have to make use of these approaches;

First thing we do is to identify partial dependencies that violate 2NF. These are attributes that are

functionally dependent on either parts of the key, {A} or {B}, alone.

We can calculate

the closures {A}+ and {B}+ to determine partially dependent attributes:

{A}+ = {A, D, E, I, J}. Hence {A} -> {D, E, I, J} ({A} -> {A} is a trivial dependency)

{B}+ = {B, F, G, H}, hence {A} -> {F, G, H} ({B} -> {B} is a trivial dependency)

To normalize into 2NF, we remove the attributes that are functionally dependent on

part of the key (A or B) from R and place them in separate relations R1 and R2,

along with the part of the key they depend on (A or B), which are copied into each of

these relations but also remains in the original relation, which we call R3 below:

R1 = {A, D, E, I, J}, R2 = {B, F, G, H}, R3 = {A, B, C}

The new keys for R1, R2, R3 are underlined. Next, we look for transitive

dependencies in R1, R2, R3. The relation R1 has the transitive dependency {A} ->

{D} -> {I, J}, so we remove the transitively dependent attributes {I, J} from R1 into a

relation R11 and copy the attribute D they are dependent on into R11. The remaining

attributes are kept in a relation R12. Hence, R1 is decomposed into R11 and R12 as

follows: R11 = {D, I, J}, R12 = {A, D, E} The relation R2 is similarly decomposed into R21 and R22 based on the transitive

dependency {B} -> {F} -> {G, H}:

R2 = {F, G, H}, R2 = {B, F}

The final set of relations in 3NF are {R11, R12, R21, R22, R3}

4 0
3 years ago
Andrew has data in cell E14 and the cell should be blank. Andrew should _____.
denpristay [2]
Use the mouse to click on cell E14 and press delete
4 0
3 years ago
Read 2 more answers
3. Cellular phone technology works on a system of geographically separated zones
Nataly [62]

Answer:

Cellular phone technology works on a system of geographically separated zones

called

B. Cells

8 0
3 years ago
What is the main difference between cell phone and mobile phone?
vitfil [10]

Answer:

A Cell Phone is, therefore, a mobile phone that works utilizing radio cells, which is an area of radio coverage. Cell phones can typically be used while moving from one cell to another without losing coverage or dropping the connection. Satellite phones are not cell phones, although they are mobile phones.

Explanation:

8 0
2 years ago
Read 2 more answers
List the correct order of steps necessary to using usmt to migrate files from an old computer to a new computer.
dlinn [17]
The USMT (User State Migration Tool) is designed to assist IT professional migrate files to the windows OS. An example is a step by step migration of files and settings from a windows XP environment to windows 8 using USMT. At the end of the day, you will have used LoadState a ScanState to complete this end to end migration. The correct order is as follows; <span><span>


1.      </span>Gather Data Using the ScanState Tool</span>

<span>a)      </span>Install USMT

<span>b)      </span>Run ScanState to Create a Migration Store on the Server

<span>2.       </span>Install Windows

<span>a)      </span>Install Applications

<span>3.       </span>Apply Data Using the LoadState Tool

<span>a)      </span>Install the USMT

<span>b)     </span> Run LoadState






8 0
3 years ago
Other questions:
  • The number of bits used to store color information about each pixel is called ____.
    13·1 answer
  • You have a network of 300 users. You are finding that you must frequently restore files from backup that users have accidentally
    13·1 answer
  • You are using Windows 10 and you have created a file with called “my text” in notepad with a .txt extension type. You need to ch
    13·1 answer
  • PLEASE HELPP!! WILL MARK BRAINLIEST!!~~~~~
    11·1 answer
  • Litmus-type test strips are used to test coolant for freeze protection and ?
    12·1 answer
  • The objective of an Enterprise Resource Planning (ERP) system is to create a customized software program that integrates the inf
    14·1 answer
  • A key field is used to _____. enter a password uniquely identify records merge data list the most important information
    12·2 answers
  • Different video files and ______ can cause compatibility issues to arise between computer systems.
    8·1 answer
  • Fre.....ee p......oint....s
    15·2 answers
  • __________ is a broad class of software that is surreptitiously installed on a user's machine to intercept the interaction betwe
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!