Question: 2. Summation Of Numbers (using Nested While Loops) Part A: The program (will calculate and display the total of all numbers up to any specific

 2. Summation Of Numbers (using Nested While Loops) Part A: The

2. Summation Of Numbers (using Nested While Loops) Part A: The program (will calculate and display the total of all numbers up to any specific number (entered by the user). Only positive numbers are allowed. Examples: When 5 is entered the program will calculate the total as 1+2++5 and display 15 . When 2 is enterered the program will calculate the total as 1+2 and display 3. Here is an example of one run of the program. Enter a positive integer number: 0 wrong input, try again. Enter a positive integer number: 2 wrong input, try again. znter a positive integer number: 5 The sum Iraen 1 to 5 in: 15 Tips: The solution of Part A consists of two loops (not nestedi). one for the input validation (only positive integer numbers allowed), followed by a second one for the calculation of the total. You must not use the sum function from Python or the mathematical formula for calculating a summation. Part B: Extend the program from part A. It will run several times, as long as the user answers ' y ' or ' Y ' when asked. Here is how this might look. Enter a positive integer number: 0 wrong input, try again. Enter a positive integer numer: 2. wrong input, try again. Knter a positive integer numberi s The sum irom 1 ta 5 ins 15 Do you want to enter another numbert (y/a)y Enter a positive integer number: 2 . The sum from 1 to 2 de: 3 De you want to eater another number? (y)n Tip: Build an outer while loop for part B around the code of part A. Both loops of part A will be nested inside the loop of part B

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!