Question: Use Python This program must use a loop and an accumulation pattern to calculate the average of a sequence of numbers. First, ask the user
Use Python

This program must use a loop and an accumulation pattern to calculate the average of a sequence of numbers. First, ask the user to tell you how many numbers you want to average. Then, use a loop to get the numbers to average from the user one at a time. Finally, compute the average and present it to the user. Example 1: Program to compute the average How many numbers would you like to average? 4 Enter number 1: 7 Enter number 2: 14 Enter number 3: 21 Enter number 4: 28 The average is 17.5 Example 2: Program to compute the average How many numbers would you like to average? 3 Enter number 1: 25 Enter number 2: 0 Enter number 3: 25 The average is 0.0 Example 3: Program to compute the average How many numbers would you like to average? 2 Enter number 1: 1 es Enter number 2: 2e3 The average is 1500.0 Hints: 1. Use the range () function in a for loop to establish the number of times you ask the user to enter a number. Do not use the number as a subscript or index into any structure. 2. Use the number produced by iterating through > for i in range (1,4) : the range () to print the number portion of the prompt = 'Number '+str (i) prompt. Convert the int to a string and concatenate it to the rest of the prompt. Consider Number 1 this console example Number 2 Number 3 3. As the user enters each number, accumulate the sum total. Do not label your variable "sum" because "sum" is also the name of a built-in function. 4. To compute an average, divide the sum of the numbers by the number of quantities
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
