subject

Write a function addupsquaresandcubes that adds up the squares and adds up the cubes of integers from 1 to n, where n is entered by the user. this function should return two values - the sum of the squares and the sum of the cubes. use just one loop that generates the integers and accumulates the sum of squares and the sum of cubes.

then, write two separate functions sumofsquares and sumofcubes to calculate the sums of the squares and sum of the cubes using the explicit formula below.

1**2 + 2**2 + 3**2 + + n**2 = n(n+1)(2n+1)/6
1**3 + 2**3 + 3**3 + + n**3 = n**2(n+1)**2/4
write functions to add these formulas to your program and print out their results as well as that of the explicit summations. the user dialog will look something like this:

warning: the equations above a math equation and the syntax may not work for python as written.

the sum of squares is 55
the sum of cubes is 225

the explicit sum of squares is 55
the explicit sum of cubes is 225

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Match the steps of the process to julia's analysis. 1. analyze choices. current costs for making phone calls to foreign countries averages between five and ten cents a minute. 2. determine the goals. julia needs to reduce the cost of telecommunications without reducing her employees' ability to do their jobs. 3. gather data. the corporate computer network will be able to handle the increased traffic that will occur as a result of voip. 4. evaluate the decision. julia will have her it department set up voip in the smallest domestic office. 5. make the decision. julia will have employees document the benefits and problems that result from using the new technology.
Answers: 1
question
Computers and Technology, 24.06.2019 21:30
How do i copy and paste equations and pictures like math graphs, to post on this site to get my questions answered?
Answers: 2
question
Computers and Technology, 25.06.2019 00:30
What is a typeface? a. a collection of similar text b. a collection of similar fonts c. a collection of similar designs d. a collection of similar colors e. a collection of similar images
Answers: 1
question
Computers and Technology, 25.06.2019 05:50
Acolor class has three public, integer-returning accessor methods: getred, getgreen, and getblue, and three protected, void-returning mutator methods: setred, setgreen, setblue, each of which accepts an integer parameter and assigns it to the corresponding color component. the class, alphachannelcolor-- a subclass of color-- has an integer instance variable, alpha, containing the alpha channel value, representing the degree of transparency of the color. alphachannelcolor also has a method named dissolve (void-returning, and no parameters), that causes the color to fade a bit. it does this by incrementing (by 1) all three color components (using the above accessor and mutator methods) as well as the alpha component value. write the dissolve method.
Answers: 2
You know the right answer?
Write a function addupsquaresandcubes that adds up the squares and adds up the cubes of integers fro...
Questions
question
Mathematics, 25.03.2021 01:40
question
Mathematics, 25.03.2021 01:40
question
Mathematics, 25.03.2021 01:40
question
Mathematics, 25.03.2021 01:40
question
Mathematics, 25.03.2021 01:40
question
Mathematics, 25.03.2021 01:40
Questions on the website: 13722361