1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Reika [66]
3 years ago
7

Write a program that prompts a user to enter numeric values. As each value is entered, the program should: - Append the value to

a list - Display the values of the list - Display the updated average of the list - Continue to prompt until the user enters any of: quit, stop, or end. Allow upper or lower case
Computers and Technology
1 answer:
VMariaS [17]3 years ago
7 0

Answer:

Following are the program in the Python Programming Language:

my_lst=[] #set list

while(True): #set while loop

 print("Enter stop, end or quit to stop the loop")

 n=input("Enter the number of elements: ")  

 #get input from user

 if(n=="quit" or n=="QUIT" or n=="stop" or n=="STOP" or n=="end" or n=="END"): #set if statement for break the loop

   print(n)

   break

 else:  #set else statement

   a=int(n) #type conversion

   for num in range(0,a): #set for loop

     l=float(input("Enter the element for list: ")) #get elements of list

     my_lst.append(l) #elements append to the list

   print("List: ",my_lst) #print list

   print("Average of the list:", sum(my_lst)/a)  

   #print average of the list

<u>Output</u>:

Enter the number of elements: 5

Enter the element for list: 1

Enter the element for list: 2

Enter the element for list: 3

Enter the element for list: 4

Enter the element for list: 5

List:  [1.0, 2.0, 3.0, 4.0, 5.0]

Average of the list: 3.0

Enter the number of elements: STOP

STOP

Explanation:

Here, we set list data type variable "my_lst" then, we set the while loop statement and pass condition "True" and inside it.

  • Then, we set a variable "n" and get input from the user in it.
  • Then, we set the if statement and pass the condition is when user input stop, end, or quit then loop is break.
  • Then, otherwise we set the variable "a" and the value of "n" is converted into the integer and store into "a".
  • Then, we set the for loop statement inside the else statement which starts from 0 to n inside the loop.
  • Then, we set the variable "l" which stores the elements of the list from the user in float data type.
  • Then, we append the elements of the "l" into the list "my_lst" and end for loop.
  • Finally, we print the list with message and then print average with message.
You might be interested in
Consider three strings instr1, instr2 and instr3 having only lowercase alphabets. Identity a string outstr, with the smallest po
soldi70 [24.7K]
10 points is nothing to answer this junk just saying
7 0
3 years ago
Which form of topology has the fastest performance?<br><br> Star<br><br> Ring<br><br> Hybrid
aivan3 [116]
The answer is ring.
Hope this helped!
3 0
3 years ago
Describe in a step by step algorithm, what you want your blinking pattern to be.
Mashcka [7]

Answer:

I would want my blinking pattern to be red first, followed by green, yellow, orange, white, purple, and cyan.

Explanation:

5 0
3 years ago
Read 2 more answers
As you are researching RAM for a computer you are building that will be used as a home office server for his small business. The
VLD [36.1K]

Answer:

ECC Ram Memory.

Explanation:

It helps protect your computer from memory errors. I have one myself for my gaming PC.

6 0
4 years ago
Read 2 more answers
What is the Microsoft excel window where you work on. And it composed of three worksheet?​
antoniya [11.8K]

Answer:

work book

Explanation:

A work book is a book in MS excel which contains work sheet

4 0
3 years ago
Other questions:
  • What is the most efficient way to include a space after each paragraph?
    13·2 answers
  • which is true someone with a low credit score I . they probably make on time payments ll . they may not be able to rent the apar
    14·2 answers
  • Which of the following is the correct style tag for having the web page's text be aligned to the right?
    6·2 answers
  • What exactly is 'epsilon' in Python?
    10·1 answer
  • Whats in a computer?
    11·2 answers
  • Enter the cube's edge: 4<br> The surface area is 96 square units.<br> Python
    12·1 answer
  • To build a framework for security policies and controls, one can use the following approach: 1) document the concepts and princi
    12·1 answer
  • 20 points for ez question lol
    9·2 answers
  • Subscribe to Markiplier
    15·2 answers
  • Write a function named parts that will take in as parameters the dimensions of the box (length, width, and height) and the radiu
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!