Question: Python programs 4.Write a program that adds up the squares and adds up the cubes of integers from 1 to N, where N is entered

Python programs

4.Write a program that adds up the squares and adds up the cubes of integers from 1 to N, where N is entered by the user: Upper Limit: 5 The sum of Squares is 55 The sum of Cubes is 225 Do this by using just one loop that generates the integers. Of course, if you really needed to calculate these sums you would use the appropriate formulas:

 Python programs 4.Write a program that adds up the squares and Add these formulas to your program and print out their results as well as that of the explicit summations.

5. Write a program that computes X N where X is a floating point number and N is a positive integer. The program informs the user that N must be positive if the user enters a negative value. Of course, X N = X * X * X * ... * X -------------------- N times The user dialog will look something like this: Enter X 1.3 Enter N 5 1.3 raised to the power 5 is: 3.71293 ------- Enter X 5.6 Enter N -3 N must be a positive integer.

12 + 2? + 32 + ... + n = n(n+1)(2n+1)/6 1 + 2 + 3 + ... + n = n(n+1)/4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!