% Write a procedure that calculates the sum of the numbers in % a given range. The parameters to this procedure should be % as follows: % % 1. The low end of the range % 2. The high end of the range % 3. The sum of the values in the range % % If the low end equals the high end, then the sum should be % whatever value is equal to the low/high end (the range is % inclusive). If the low end is greater than the high end, % then failure should occur.

Answers

Answer 1

Answer:

The procedure in python 3 is as follows:

def add_range(low,high):

   if low<= high:

       total = 0

       for i in range(low,high+1):

           total+=i

       return total

   else:

       return "Failure"

Explanation:

This defines the function/procedure

def add_range(low,high):

If low is less or equal to high

   if low<= high:

Initialize total to 0

       total = 0

Add up numbers in the range

       for i in range(low,high+1):

           total+=i

Return the total

       return total

If low is greater, then return failure

   else:

       return "Failure"


Related Questions

Which visualization is good to represent values that change with change in time?

Answers

Answer:

???

i would help but gotta explain more

Explanation:

Answer:

A box plot can be helpful when a distribution of values needs to be considered for each time period; each set of box and whiskers can show where the most common data values lie.

Explanation:

In this lab, you complete a C++ program that swaps values stored in three int variables and determines maximum and minimum values. The C++ file provided for this lab contains the necessary variable declarations, as well as the input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate. Comments included in the code tell you where to write your statements.InstructionsEnsure the Swap.cpp file is open in your editor.Write the statements that test the first two integers, and swap them if necessary.Write the statements that test the second and third integer, and swap them if necessary.Write the statements that test the first and second integers again, and swap them if necessary.Execute the program by clicking the "Run Code" button at the bottom of the screen using the following sets of input values.101 22 -23630 1500 921 2 2Provided code:// Swap.cpp - This program determines the minimum and maximum of three values input by// the user and performs necessary swaps.// Input: Three int values.// Output: The numbers in numerical order.#include using namespace std;int main(){ // Declare variables int first = 0; // First number int second = 0; // Second number int third = 0; // Third number int temp; // Used to swap numbers const string SENTINEL = "done"; // Named constant for sentinel value string repeat; bool notDone = true; //loop control // Get user input cout << "Enter first number: "; cin >> first; cout << "Enter second number: "; cin >> second; cout << "Enter third number: "; cin >> third; while(notDone == true){ // Test to see if the first number is greater than the second number // Test to see if the second number is greater than the third number // Test to see if the first number is greater than the second number again // Print numbers in numerical order cout << "Smallest: " << first << endl; cout << "Next smallest: " << second << endl; cout << "Largest: " << third << endl; cout << "Enter any letter to continue or done to quit: "; cin >> repeat; if (repeat == SENTINEL){ notDone = false; } else { cout << "Enter first number: "; cin >> first; cout << "Enter second number: "; cin >> second; cout << "Enter third number: "; cin >> third; } return 0;} // End of main function

Answers

Answer:

Following are the code to the given question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

int first = 0,second = 0,third = 0;//defining integer variable  

int temp; //defining integer variable

const string SENTINEL = "done"; // defining a string variable as constant  

string repeat;// defining a string variable  

bool notDone = true; //defining bool variable

cout << "Enter first number: ";//print message

cin >> first;//input value

cout << "Enter second number: ";//print message

cin >> second;//input value

cout << "Enter third number: ";//print message

cin >> third;//input value

while(notDone == true)//defining a loop to check the value  

{

if(first > second)//use if to compare first and second value

{

int temp = first;//defining temp to hold first value

first = second;//holding second value in first variable

second = temp;//holding temp value in second variable

}

if(second > third)//use if to compare second and third value

{

int temp = second;//defining temp to hold second value

second = third;//holding second value in third variable

third = temp;//holding temp value in third variable

}

cout << "Smallest: " << first << endl;//print smallest value

cout << "Next smallest: " << second << endl;//print Next smallest value

cout << "Largest: " << third << endl;////print Largest value

cout << "Enter any letter to continue or done to quit: ";//print message

cin >> repeat;//holding string value

if (repeat == SENTINEL)

{

notDone = false;//holding bool value

}  

else //else block

{

cout << "Enter first number: ";//print message

cin >> first;//input value

cout << "Enter second number: ";//print message

cin >> second;//input value

cout << "Enter third number: ";//print message

cin >> third;//input value

}

return 0;

}

}

Output:

Please find the attached file.

Explanation:

Inside the main method Four integer variable "first, second, third, and temp" is declared in which first three variable is used for input value and temp is used to compare value. In thew next step, two string variable "SENTINEL and repeat" is declared in which "SENTINEL" is constant and a bool variable "notDone" is declared. After input the value from the user-end a loop is declared that compare and swap value and print its value.

What is the difference between autofocus and autocomplete

Answers

Answer:

https://www.c-sharpcorner.com/interview-question/explain-autofocus-and-autocomplete-attribute

found this on a website hope you find it useful !

Sam plans to use this image in artwork for a brochure about airplanes. Which principles of page layout is Sam planning to use in this artwork?

A. emphasis
B. repetition
C. balance
D. alignment
E. proximity

Answers

Answer: Alignment

Explanation:

The principle of repitition indicates that some aspect of a design are repeated. This can be in form of bullet list, lines, color etc.

Balance has to do with how the weight is distributed.

The Principle of Alignment means that the pictures on a page should be connected visually to another thing.

Principle of Proximity simoly means that the items that are related on a page should be close to each other.

Therefore, the principles of page layout that Sam is planning to use in this artwork is alignment.

Answer:

D. alignment

Explanation:

Write a program to sort the (name, age, score) tuples by descending order where name is string, age and score are numbers. The sort criteria is: 1: Sort based on name 2: Then sort based on age 3: Then sort by score The priority is that name < age < score. If the following tuples are given as input to the program: [('John', '20', '91'), ('Jason', '21', '85'), ('Jony', '17', '91'), ('Johny', '17', '93'), ('Tom', '19', '80')]\

Answers

Answer:

The program in Python is as follows:

from operator import itemgetter

m = int(input("Number of records: "))

print("Name, Age, Score")

my_list =[]

for i in range(m):

   user_details = input()

   my_list.append(tuple((user_details.split(","))))

my_list.sort(key =  itemgetter(0, 1, 2))        

print("Sorted: ", my_list)

Explanation:

This imports the operator function from itemgetter

from operator import itemgetter

This gets the number of records, m

m = int(input("Number of records: "))

This prints the format of input

print("Name, Age, Score")

This initializes the list of tuples

my_list =[]

This iterates through m

for i in range(m):

This gets the details of each person

   user_details = input()

This appends the details to the tuple

   my_list.append(tuple((user_details.split(","))))

This sorts the tuple

my_list.sort(key =  itemgetter(0, 1, 2))        

This prints the sorted tuple

print("Sorted: ", my_list)

Write a class called AddThreeGame that allows two players to play a game in which they alternately choose numbers from 1-9.

Answers

Answer:

Explanation:

The following code is written in Python, it creates the AddThreeGame as requested for 2 players. Outputting the desired output after each player has chosen a number and checking for a winner after every choice. Due to technical reasons, I had to add the code as a txt file below and the output can be seen in the attached picture.

what is software? what are two types of software?​

Answers

Software is the programs and other operating information used by a computer. Two types of software are system software and Application software. Hope this helps :)

Answer:

Software is the collection of programs which makes computer work. The two types of software are 1)Application software

2)System software

Define a method calcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. calcPyramidVolume() calls the given calcBaseArea() method in the calculation.

Answers

Answer:

The method in C++ is as follows:

double calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight){

   double baseArea = calcBaseArea(baseLength, baseWidth);

   double volume = baseArea * pyramidHeight;

   return volume;    

}

Explanation:

This defines the calcPyramidVolume method

double calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight){

This calls the calcBaseArea method to calculate the base area of the pyramid

   double baseArea = calcBaseArea(baseLength, baseWidth);

This calculates the volume

   double volume = baseArea * pyramidHeight;

This returns the volume

   return volume;  

}

See attachment for complete program that include all methods that is required for the program to function.

Which programming paradigm does the programming language JavaScript follow?
A. procedural programming
B. object-oriented programming
C. functional programming
D. Imperative programming​

Answers

Its not functional programming (sorry)

Answer:

Object-oriented programming

Explanation:

Just took the test and got it right

Happy to help !!

Which measurement symbol is this?
PLS HELP

Answers

Answer:

Foot.

Explanation:

Hope this helps!

Sean works for an organization that offers SaaS to a chain of boutiques.By getting data from the database,he has to prepare a list of instances when the billing transaction failed.Which of the following tasks does he need to do to prepare the report?
A) Create queries to get relevant data
B) Specify layout and format
C) Establish relationship between data
D) Add data to the report by running it

Answers

Answer: A) Create queries to get relevant data

B) Specify layout and format

D) Add data to the report by running it

Explanation:

SaaS is a software delivery method which allows the access of data from any device when there's a web browser and an internet connection and a web browser.

Since Sean wants to prepare a list of instances when the billing transaction failed, he'll need to:

• Create queries to get relevant data

• Specify layout and format

• Add data to the report by running.

Therefore, the correct options are A, B and D.

In python, sorry if it’s blurry

Answers

Answer:

nice

Explanation:

lst = [[6,-3,8,0,5,-1,2,-2],[-7,4,3,-5,8,9,1,6]]

neg_values = 0

for x in lst:

   for y in x:

       if y<0:

           neg_values += 1

print(neg_values)

I wrote my code in python 3.8. I hope this helps

Match each code snippet to its appropriate markup language name. XML CSS HTML XHTML


Answers

Answer:

Please find the complete solution in the attached file.

Explanation:

answer:

<p>line break</p><br/>  : XHTML

<Address>24, North Block</Address> : XML

<P>New paragraph</P> : HTML

<h2 style=“color:red;font-size:12px;”>Heading in red color.</h2> : CSS

just truuust

What component can you use to open windows?

Answers

Answer:

Start Windows 10 Component Services via the Run dialog box. Press Win+ R keyboard shortcuts to launch Run dialog box, type dcomcnfg or dcomcnfg.exe in the box and click OK/press Enter to open Component Services.

Explanation:

which of the following resources type is mostly likely to be shared common resource in a computer network environment
a) printers
b) floppy disk drives
c) speakers
d) keyboards​

Answers

Answer:

A )Printer

Explanation:

In office multiple user can send request to print a doc......

Write a function using a loop to approximate the value of PI using the formula given including terms up through 1/99, 1/999 and 1/9999. As the number of iterations increase, the estimate gets closer to the value of PI. The function should accept the number of iterations and return the estimate of PI.

Answers

Answer:

Following are the code to the given question:

#include <stdio.h>//header file

double estPi(int precision)//defining a method estPi that accepts value in parameter  

{

   double pi = 0, sign = 1, n = 1;//defining a double variable

   while (n <= precision) //use while loop that checks n value less than equal to precision

   {

       pi += sign / n;//defining pi variable that holds quotient value

       sign *= -1;//holding value in sign value

       n += 2;//increment value in n

   }

   return 4 * pi;//return value

}

int main() //main method

{

   int n;//defining an integer variable

   printf("Enter number of iterations: ");//print message

   scanf("%d", &n);//input value

   printf("Estimated PI is %lf\n", estPi(n));//print method that calls method

   return 0;

}

Output:

Please find the attached file.

Explanation:

In the given code a method "estPi" is declared that holds an integer variable "precision" is declared inside the method multiple double variable is declared inside the loop it calculate the value and return its values.

Inside the main method an integer variable "n" is declared that use print method to input the value and accepting value from the user-end and passing value in the method and print its values.

Answer:

Following are the code to the given question:

#include <stdio.h>//header file

double estPi(int precision)//defining a method estPi that accepts value in parameter  

{

  double pi = 0, sign = 1, n = 1;//defining a double variable

  while (n <= precision) //use while loop that checks n value less than equal to precision

  {

      pi += sign / n;//defining pi variable that holds quotient value

      sign *= -1;//holding value in sign value

     n += 2;//increment value in n

}

  return 4 * pi;//return value

}

int main() //main method

{

  int n;//defining an integer variable

  printf("Enter number of iterations: ");//print message

  scanf("%d", &n);//input value

  printf("Estimated PI is %lf\n", estPi(n));//print method that calls method

  return 0;

}

Output:

Please find the attached file.

In the given code a method "estPi" is declared that holds an integer variable "precision" is declared inside the method multiple double variable is declared inside the loop it calculate the value and return its values.

Inside the main method an integer variable "n" is declared that use print method to input the value and accepting value from the user-end and passing value in the method and print its values.

Answer: Following are the code to the given question: #include - 1

Explanation:

List 5 properties and metrics for specifying non-functional requirements.

Answers

Answer:

- performance

scalability

capacity

availability

reliability

Thomas owns a small Web services company and currently owns and maintains all his own computing hardware. He plans to develop and test a new service offering that will require his computing capacity to double or triple quickly if it proves successful. How might transitioning to the public cloud help Thomas with this situation

Answers

Answer: Hello the options related to your question is missing attached below are the options

answer : unlimited computing capacity for a low monthly fee ( A )

Explanation:

Since Thomas plans to develop a new service that will require his computing capacity to either double or triple, The best way of transitioning to the public cloud that might help Thomas meet up the requirement is Using unlimited computing capacity for a low monthly fee

Telephone – Cable/ Radio -​

Answers

Answer:

Telephone – Cable/ Radio -​ Wireless

Write a class Bug that models a bug moving along a horizontal line. The bug moves either to the right or left. Initially, the bug moves to the right, but it can turn to change its direction. In each move, its position changes by one unit in the current direction. Provide a constructor

Answers

Answer:

Following are the constructor to the given code:

Bug(int position) //defining a constructor that defines a integer parameters

{

       this.position = position;//use this key word to hold parameter value

       right = true;//defining a variable right that hold a boolean value

   }

Explanation:

In this code, a constructor is declared that defines integer parameters with it, Inside the constructor, this keyword is used to holds the "position" parameter value and defines a boolean variable "right" that holds a boolean value.

Full program:

public class Bug //declaring a class Bug

{

   private int position;//declaring integer variable position

   private boolean right;//declaring boolean variable

   public Bug(int position) //defining a parameterized constructor

   {

       this.position = position;//use this to hold position value

       right = true;//holding boolean value

   }

   public void turn() //defining a method turn

   {

       right = !right;//holding value

   }

   public void move() //defining method move

   {

       if(right)//use if to check boolean value

       {

           position++;//incrementing position value

       }  

       else//else block

       {

           position--;//decreasing position value

       }

   }

   public int getPosition()//defining method getPosition  

   {

       return position;//return position value

   }

   public static void main(String[] args) //main method

   {

       Bug bug = new Bug(10);//creating class object

       System.out.println("Expected = 10, Actual = " + bug.getPosition());//calling method with printing value

       bug.move();//calling method

       System.out.println("Expected = 11, Actual = " + bug.getPosition());//calling method with printing value

       bug.move();//calling method

       bug.move();//calling method

       bug.move();//calling method

       System.out.println("Expected = 14, Actual = " + bug.getPosition());//calling method with printing value

       bug.turn();//calling method

       bug.move();//calling method

       bug.move();//calling method

       System.out.println("Expected = 12, Actual = " + bug.getPosition());//calling method with printing value

       bug.turn();//calling method

       bug.move();//calling method

       System.out.println("Expected = 13, Actual = " + bug.getPosition());//calling method with printing value

   }

}

Output:

Please find the attached file.

At each step it should print out the move it makes and its performance score (e.g. S 0.2). Every 5 steps, it should print out a grid, with a "[ ]" on the square where the robot is now. Thus, with the above input, if the robot has done S U S L S, the output would be:

Answers

Answer:

The output would be S 0.2 U 0.2 S 0.2 U 0.2 L 0.2 S 0.2 [ ]

Explanation:

Given that at each step output prints for example S 0.2.

Also given after every 5 steps, it should print a grid "[ ]".

if robot has been given S U S L S, it prints output as

S 0.2 U 0.2 S 0.2 U 0.2 L 0.2 S 0.2 [ ]

In which SDLC step does the company translate broad, user-oriented systems requirements into the detailed specifications used to create a fully developed system

Answers

Answer:

Physical design.

Explanation:

Systems development life cycle (SDLC) is a strategic process that involves determining the overall system architecture, which is typically comprised of hardware, end users, physical processing components, software, and the communication channel that will effectively and efficiently satisfy the essential requirements of the system.

The system inputs and outputs is typically designed along with a plan of how the system's features will be navigated.

Basically, system design is divided into two (2) categories and these includes;

I. Logical design.

II. Physical design.

Furthermore, the design of service systems involves the process of planning, creating infrastructure, building communication, organizing staffs and standardization of a system so as to improve its quality and business relationships between the service provider and its clients.

In the physical design of systems development life cycle (SDLC), broad, user-oriented systems requirements are obtained from end users by companies and then translated into the detailed specifications that would be used to create a fully developed system.

g Why do database systems support concurrent execution of transactions, despite the extra effort needed to ensure that concurrent execution does not cause any problems

Answers

Answer:

Explanation:

To maintain data consistency and integrity in a large multi-user system, transactions are completed concurrently with the aid of concurrency management techniques.

The following are some of the benefits of concurrent transaction processing and execution versus serial transaction processing and/or execution:

Improved Resource Usage:

A transaction frequently combines both CPU and Input/output activities, resulting in better resource usage. Computers have the ability to run disks and CPUs in parallel. As a result, transactions can also be executed in parallel, with one employing the usage of the CPU and the other using the disk. As a result, resources are better used than in serial transaction processing and execution.

Improved throughput:

Running transactions in parallel has an immediate impact of increasing throughput since a greater number of transactions can be completed in the same period of time.

Lower/shorter waiting time:

Reduced wait time: When transactions are processed sequentially and serially, a short transaction is forced to wait for a longer transaction. Because transactions usually affect distinct portions of the database. As such, it's best if they happen at the same time i.e it is run concurrently.

The characteristics listed above are critical to a system's performance.

Thus, It is obvious that the benefits of concurrency exceed the extra programming work necessary to execute transactions concurrently. As a result, database systems must handle concurrent transactions despite the additional work necessary since it is worthwhile.

write a program to input 100 students marks and find the highest marks among the them​

Answers

Answer:

Explanation:

The following code is a Python program that allows you to input 100 marks. You can input the value -1 to exit the loop early. Once all the marks are entered the program prints out the highest mark among all of them. The output can be seen in the attached picture below with a test of a couple of marks.

marks = []

for x in range(100):

   mark = int(input("Enter a mark: "))

   if mark == -1:

       break

   else:

       marks.append(mark)

print("Max value: " + str(max(marks)))

Find out the actual instruction given in binary

Answers

Your question is incomplete.

hope its helpful.

Which is the best definition of manageable?
A. asking for help from others
B. making a plan
C. breaking down a big goal into smaller pieces
D. creating multiple goals

Answers

Answer:

D. Creating mutiple goals.

Explanation:

(b) Write a program which displays the following pattern as an output.
*
**
***
****
*****
(Hint: using loop)

Answers

this is the answer for your question i´m guessing i hope this helped :)

******

What are two different ways by which a laptop could utilize the cellular network connection of a mobile device

Answers

Answer:

Tethering and hotspot

Explanation:

Tethering and hotspot are the two different ways by which a laptop could utilize the cellular network connection of a mobile device.

Tethering usually involves connecting the computer or smartphone to the internet with the aid of a USB cable while hotspot involves connection of the device to the internet through the WIFI option.

Which telecommunications service allow Internet and telephone service services to work over the same phone line

Answers

Answer:

VoIP

Explanation:

Voice over Internet Protocol

Answer:

DSL

Explanation:

I took the test and got it right.

6.What does transgenic mean?​

Answers

answer:

transgenic means that one or more DNA sequences from another species have been introduced by artificial means.

explanation:

transgenic plants can be made by introducing foreign DNA into a variety of different tissuestransgenic mice are one of the most common animal models used

relating to or denoting an organism that contains genetic material into which DNA from an unrelated organism has been artificially introduced. being or used to produce an organism or cell of one species into which one or more genes of another species have been incorporated a transgenic mouse transgenic crops and produced by or consisting of transgenic plants or animals.

Other Questions
The beginning of the story is: Things were so extravagant. So over the top. Im amazed that we were able to pull it all off because things didnt look too well before. But now look at us, happy, proud and.... Which of the following is an example of first person point of view? BONUS 1) You take the Math Time Machine into the past to save Julius Caesar and fix the calendar,but you miss your timestamp and end up in Alexandria a few years early. You wander around beforeending up in front of the Great Library of Alexandria, which is guarded by a sphinx - known inmythology for their tricky riddles. When you ask the sphinx what year it is, it refuses to answerunless you solve a math problem. The sphinx shows you a right triangle with a base of 8 and a heightof 6, which you know has an area of 24. Then it tells you that if you that you can remove somelength x off of the 8 side, but if you do that you must add a rectangle under the 8 side with a heightequal to x, thus creating a trapezoid. How much length must you remove from the 8 side so thetrapezoid has the same area as the original triangle? X = 0 doesn't count.a) X = 2b) X = 3c) X = 4d) X = 5 Which option is the clearest example of internal conflict? PLEASE THIS IS TIMED I REALLY NEED HELP AND BRAINLIEST!! :(PLEASE ONLY PUT CORRECT ANSWER!! :)answers :10^2110^4224^2124^42 Find the first five terms that correspond with the following expression.4n + 2 Solve please!! Please hurry this is due today!! Can anyone help me solve a logarithm question? Q2The function R(t) = 50e -0.013tmodels the numberof grams in a sample of radium after t years. On whichinterval is the sample's average rate of decay theslowest?[0, 5][10, 20][25, 30][25,35] Which phrases representing the idea of freedom connect the poem to the autobiography? THIS IS WORTH 100 POINTSLil Baby vs DaBabyWho is the better rapper/songwriter?its only worth 10 lol Nancy is making accessories for the soccer team. She uses 542.43 inches of fabric on headbands for 37 players and 4 coaches. She also uses 314.87 inches of fabric on wristbands for just the players. How much fabric was used on a headband and wristband for each player? What were the black Codes? .A. Laws enacted to pursue Confederates who did notpledge loyalty to the UnionB. Laws enacted to dissuade President Johnson fromvetoing bills that would help the freed slavesC. Laws enacted to control freed men and women A rectangle has a perimeter of 14 cm and length x cm. show that the width of the rectangle is (7-x)cm and hence that the area A of the rectangle is given by the formula A= x(7-x). Draw the graph, plotting x on the horizontal axis with a scale of 2cm to 1 unit, and A on the vertical axis with a scale of 1cm to 1 unittake x from 0 to 7. From the graph find:a) the area of the rectangle when x = 2.25cm b) the dimensions of the rectangle when its area is 9cm^2c) the maximum area of the rectangled) the length and width of the rectangle corresponding to the maximum areae) what shape of the rectangle has the largest area metion form of ownership represented by the SABC OF SOUTH AFRICA How is the Earth of the 22nd century different from the Earth of today? Which function is the inverse off(x)= x+4?A. F'(x) = (x - 4)B. F"(x) =-**-4C. ('(x) = x3-4D. f '(x) = 4 - x?Help quick Its simple math Im just confused Parallel rays from a distant object are traveling in air and then are incident on the concave end of a glass rod with a radius of curvature of 15.0 cm. The refractive index of the glass is 1.50. What is the distance between the vertex of the glass surface and the image formed by the refraction at the concave surface of the rod? Is the image in the air or in the glass? Suppose we want to choose 5 letters without replacement from 16 distinct letters