3. Write a function named sum_of_squares_until that takes one integer as its argument. I will call the argument no_more_than. The function will add up the squares of consecutive integers starting with 1 and stopping when adding one more would make the total go over the no_more_than number provided. The function will RETURN the sum of the squares of those first n integers so long as that sum is less than the limit given by the argument

Answers

Answer 1

Answer:

Following are the program to this question:

def sum_of_squares(no_more_than):#defining a method sum_of_squares that accepts a variable

   i = 1#defining integer variable  

   t = 0#defining integer variable

   while(t+i**2 <= no_more_than):#defining a while loop that checks t+i square value less than equal to parameter value  

       t= t+ i**2#use t variable to add value

       i += 1#increment the value of i by 1

   return t#return t variable value

print(sum_of_squares(12))#defining print method to call sum_of_squares method and print its return value

Output:

5

Explanation:

In the program code, a method "sum_of_squares" is declared, which accepts an integer variable "no_more_than" in its parameter, inside the method, two integer variable "i and t" are declared, in which "i" hold a value 1, and "t" hold a value that is 0.

In the next step, a while loop has defined, that square and add integer value and check its value less than equal to the parameter value, in the loop it checks the value and returns t variable value.


Related Questions

Which interpersonal skill is the most important for a telecom technician to develop?
teamwork
active listening
conflict resolution
social awareness

Answers

Answer: Interpersonal communication is the process of face-to-face exchange of thoughts, ideas, feelings and emotions between two or more people. This includes both verbal and nonverbal elements of personal interaction.

Explanation:

i think plz dont be mad

Pointers are addresses and have a numerical value. You can print out the value of a pointer as cout << (unsigned)(p). Write a program to compare p, p + 1, q, and q + 1, where p is an int* and q is a double*. Explain the results.

Answers

Answer:

#include <iostream>

using namespace std;

int main() {

  int i = 2;

  double j = 3;

 

  int *p = &i;

  double *q = &j;

 

  cout << "p = " << p << ", p+1 = " << p+1 << endl;

  cout << "q = " << q << ", q+1 = " << q+1 << endl;

  return 0;

}

Explanation:

In C++, pointers are variables or data types that hold the location of another variable in memory. It is denoted by asterisks in between the data type and pointer name during declaration.

The C++ source code above defines two pointers, "p" which is an integer pointer and "q", a double. The reference of the variables i and j are assigned to p and q respectively and the out of the pointers are the location of the i and j values in memory.

A video game character can face one of four directions

Answers

Really
I didn’t know that:)

Which of the following is NOT true?

a. The process provides the macro steps
b. Methodologies provide micro steps that never transcends the macro steps.
c. Methodologies provide micro steps that sometimes may transcend the macro steps.
d. A methodology is a prescribed set of steps to accomplish a task.

Answers

Answer:

b. Methodologies provide micro-steps that never transcends the macro steps.

Explanation:

Methodologies are a series of methods, processes, or steps in completing or executing a project. Projects can be divided into macro steps or processes and these macro steps can be divided into several micro-steps. This means that, in methodology, micro-steps always transcends to a macro-step.

What line of code makes the character pointer studentPointer point to the character variable userStudent?char userStudent = 'S';char* studentPointer;

Answers

Answer:

char* studentPointer = &userStudent;

Explanation:

Pointers in C are variables used to point to the location of another variable. To declare pointer, the data type must be specified (same as the variable it is pointing to), followed by an asterisk and then the name of the pointer. The reference of the target variable is also assigned to the pointer to allow direct changes from the pointer variable.

A series of gentle often open-ended inquiries that allow the client to progressively examine the assumptions and interpretations here she is made about the victimization experience is called:_____.

Answers

Answer:

Trauma Narrative

Explanation:

Given that Trauma narrative is a form of narrative or carefully designed strategy often used by psychologists to assists the survivors of trauma to understand the meaning or realization of their experiences. It is at the same time serves as a form of openness to recollections or memories considered to be painful.

Hence, A series of gentle often open-ended inquiries that allow the client to progressively examine the assumptions and interpretations he or she is made about the victimization experience is called TRAUMA NARRATIVE

Any one know??please let me know

Answers

Answer:

B

Explanation:

Answer:

The answer is B.

Explanation:

Also I see your using schoology, I use it too.

Suppose an application generates chunks 60 bytes of data every 200msec. Assume that each chunk gets put into a TCP packet (using a standard header with no options) and that the TCP packet gets put into an IP packets. What is the % of overhead that is added in because of TCP and IP combines?
1) 40%
2) 10%
3) 20%
4) 70%

Answers

Answer:

1) 40%

Explanation:

Given the data size = 60 byte

data traversed through TSP then IP

Header size of TCP = 20 bytes to 60 bytes

Header size of IP = 20 bytes to 60 bytes

Calculating overhead:

By default minimum header size is taken into consideration hence TCP header size = 20 bytes and IP header size = 20 bytes

Hence, the correct answer is option 1 = 40%

Other Questions
During the late 1600s, a decline in the availability of indentured servants led to what? 4) How did the Seminole Native Americans unknowingly lead to the USacquiring Florida? I need help asap :(( I'm really stuck and don't know what to right for this rough draft for Water Consumption. Write a rough draft for water consumption. I WILL MAKE U BRAINLIEST PLEASE ANSWER !!!!!!!!Venmoing if answered ANSWER PLS ! 15 POINTS! Question: If you are traveling by train and the trip is 125 miles and takes 2 hours winding through the mountains, a) whats average speed? b) how would this be different if the train in each of the following situations- Train at rest, Train traveling at constant speed in a straight line, and the Train with a braking force (the train in the middle of coming to a stop) PLEASE ANSWER ALL ASAP Given slope = -5 & y-intercept = (0,0) write the equation The ratio of boys to girls in Coach Sheppard's class is 3 to 5. There are 20 girls in theclass.What is the total number of students in Coach Sheppard's class? All of the following are characteristics of proteins EXCEPT: A They contain genetic information B They can catalyze chemical reactions. c They can transport materials. D They can repair tissues. Pencils were ordered in boxes containing 6 pencils each. The grade level has 100 students. If the teachers want to start the year with 4 pencils per student, how many boxes do they need to buy before the school year starts? Som eone g ive me motiva tion for school i fa iled every class then I d k anymore so MAny a-sigmentsanyon e else- pls please please answer !!! Does anyone know how to do this Ive been trying for hours and I cant find anything to help me? Write an equation for the sentence. A pizza with 15 slices is shared equally among n students. Each student gets 3 slices. giving brain liest for who ever answers the whole thing!! you have to of read the book and have to read chapter 7 to answer unless you know them !! What is known as something to witch a person migrates to certain place because they are attracted by a benefit Plzzzzz helppppp meeee.!!!!!!!!! pls help i'll give branliest the boiling points of two liquids are 120C and 240C, to what minimum temperature do I have to heat them in order to separate them? A sixth-grade student bought three cans of tennis balls for $4 each. The sales tax for each can was $.95. Which expression(s) can be used to find the total amount the student spent. Select all that apply. Will mark the brainliest ________ is defined as average kinetic energy.A. temperatureB. volumeC. heatD. pressure