Develop a python program which will calculate the sum of an


Programming with Control Structures

Develop a Python program which will calculate the sum of an integer series, as described below. The program wil repeatedly prompt he user to enter a command (a character string). The program wil halt and display the mesage "Program halted normaly" when the command is "exit". When the command is "squares", the program wil prompt he user to enter the inital integer number in the series and then the number of terms in the series. It wil use repetion to compute the sum of the series, and then display the results. For example, if the inital integer is 2 and the number of terms is 4:

Sum = 2^2 + 3^2 + 4^2 + 5^2 = 54

When the command is "cubes", the program wil prompt he user to enter the inital integer number in the series and then the number of terms in the series. It wil use repetion to compute the sum of that series, and then display the results. For example, if the inital integer is 3 and the number of terms is 2:

Sum = 3^3+ 4^3 = 91

  • The program wil display the mesage "** Invalid choice **" if the user enters an invalid command.
  • The program wil use repetion to compute the sums (rather than using a closed form equation). After
  • al, the point is to practice with nest control constructs.
  • You may asume that he user enters integer numbers when prompted for numeric values.

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Develop a python program which will calculate the sum of an
Reference No:- TGS01033771

Expected delivery within 24 Hours