Need Help ?

Home / Expert Answers / Other / 2-summation-of-numbers-using-nested-while-loops-part-a-the-program-will-calculate-and-display-the-to

(Answered): 2. Summation Of Numbers (using Nested While Loops) Part A: The program will calculate and display t ...




2. Summation Of Numbers (using Nested While Loops) Part A: The program will calculate and display the total of all numbers upWrite an algorithm that gets four integer numbers corresponding to scores received on three quizzes and a final examination.Lab 7-1 Scope of Variables / Review Functions #definitions of the functions det myPunction (number): x-7 + number print (x) d
2. Summation Of Numbers (using Nested While Loops) Part A: The program will calculate and display the total of all numbers up to a specific number (entered by the user). Only positive numbers are allowed. Part B: User-controlled loop Part A: Input Validation loop Part A: Summation loop 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. Enter a positive integer number: 5 The sum from 1 to 5 is: 15 Tips: The solution of Part A consists of two loops (not nested!), one for the input validation (only positive integer numbers allowed), followed by a second one for the calculation of the total. Write an algorithm that gets four integer numbers corresponding to scores received on three quizzes and a final examination. Your algorithm should compute and display the average of all four tests, weighting the final exam twice as heavily as a regular quiz. Lab 7-1 Scope of Variables / Review Functions #definitions of the functions det myPunction (number): x-7 + number print (x) det myPunction (number): x - 7. number return x def myPunction2 ): return x + 4 the main program, where functions are X-5 print (x) myPunction (2) print("myFunction returns: str tayPune print (x) print("myPunction2 returns: strlayPunc Answer the following questions about the program above) in the online text-editor. (add submission will open this editor). No file submission! You must submit your own work. 1. Which of the defined functions are fruitful functions? 2. Which of the defined functions are void functions? 3. Which Python built-in functions are used? For each one is this a fruitful or a void function? 4. In the above program, what is the parameter of myFunction? 5. What is the argument when myFunction is called? 6. Which variables are global variables? 7. For each function: What are the local variables and the local parameters? 8. What does the program print? (There are 5 print statements!) 9. Redefine myFunction 2. Instead of using a global variable it should use a parameter.


We have an Answer from Expert

View Expert Answer

Expert Answer


Answer to 2. Summation Of Numbers (using Nested While Loops) Part A: The program will calculate and display the total of all numbe...
We have an Answer from Expert

Buy This Answer $4

Place Order