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
Review universal data models and discuss how these are being used more widely today. Does a data modeling project using a packag
adell [148]

Answer:

2. A data modelling project using a packaged data model REQUIRES A GREATER SKILL than a project not using a packaged data model.

Explanation:

1a. Review of universal models:

A data model is an abstract model that organizes elements of data and standardizes how they relate to one another and to the properties of real world entities. It has become the standard approach used towards designing databases.

A universal data model is a template data model that can be reused as a starting point or a building block to jump-start development of a data modelling project, industry specific model, logical data models.

1b. Discuss how these are being used more widely today.

*Universal data models helps professional reduce development time, improve consistency and standardization while achieving high quality models.

*Higher quality: just as architects consider blue prints before constructing a building, one should also consider data before building an app. A data model helps define the problem, enabling one to consider different approaches and choose best ones.

*By properly modelling and organization's data, the database designer can eliminate data redundancies (needless repetitions) which are a key source for inaccurate information and ineffective systems.

2. Greater and advanced skills are adequate and required when data modelling project is done using packaged data model while fewer skills are required when data modelling is done without packaged data model.

7 0
2 years ago
Read 2 more answers
Determine whether the compound condition is True or False.
Vlada [557]

The  compound condition are:

  • 7<12 or 50!=10 is false
  • 7<12 and 50<50 is false
  • not (8==3) is true

<h3>What is compound condition?</h3>

A compound statement is known to be one that shows up as the body of another statement, e.g. as in if statement.

The  compound condition are:

  • 7<12 or 50!=10 is false
  • 7<12 and 50<50 is false
  • not (8==3) is true

Learn more about compound condition  from

brainly.com/question/18450679

#SPJ1

8 0
1 year ago
Wap in java to complete the following (16*1) +(14*2) +(12*3) +(10*4) +(8*5) +(6*6) +(4*7)​
vladimir1956 [14]

Answer:

It goes like:

public class Program

{

public static void main(String[] args)

{

int j=18;

int sum=0;

for (int i =1; i<7; i++)

{

sum=sum+(i*(j-2));

j=j-2;

}

System.out.println(sum);

}

}

Explanation:

<u>Variables used: </u>

j : controls the first number in product and decreases by 2 each time the loop runs.

sum: saves the values of addition as the loop runs.

3 0
2 years ago
The term drive app is used to describe applications stored on a computer true or false
Volgvan
Hello <span>Areyano7475
</span>

Question: T<span>he term drive app is used to describe applications stored on a computer true or false


Answer: False


Hope this helps
-Chris</span>
7 0
3 years ago
Read 2 more answers
If the motherboard is not getting power, it will not start the boot. ... A four-year old laptop will not boot and presents error
lakkis [162]

Answer:

<em>The right order of steps you should take to repare the laptop is: D A C B</em>

<em>Explanation:</em>

<em>D. Ask yourself if the laptop is still under warranty: Because they will replace the board for you or give you a new machine.</em>

<em>A. Ask yourself if replacing the motherboard will cost more than purchasing a new laptop: since technology evolve every day, you might consider buying a new faster, better, advanced machine.</em>

<em>C. Find the service manual to show you how to replace the motherboard: the support assistence will guide you trhough the right way of replacing the board.</em>

<em>B. Find a replacement motherboard: choose the specific one or maybe try to find a better model, that can improve your computer performance.</em>

7 0
3 years ago
Other questions:
  • Assume the following JavaScript program was interpreted using staticscoping rules. What value of x is displayed in function sub1
    12·1 answer
  • This question is for one of my classes I am in right now, and the question is:
    8·1 answer
  • Ecommerce sites sell this to generate income
    11·1 answer
  • PLEASE HELP ME ASP<br> An ISDN carries a signal in digital form.<br><br> True<br><br> False
    12·2 answers
  • Line spacing refers to the amount of space between each line in a paragraph. A. True B. False
    14·2 answers
  • A(n) is the tool that will help you the most when developing the content you will use in your presentation.
    10·1 answer
  • Donna often travels around the world. When she travels, she needs to access her emails from different locations. However, to kee
    6·2 answers
  • Which of the following is true of operations within a spreadsheet program’s built-in functions?
    15·2 answers
  • Which activity is the best example of a negative habit that may result from
    12·1 answer
  • Using C++
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!