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
antiseptic1488 [7]
3 years ago
8

You want to know your grade in Computer Science, so write a program that continuously takes grades between 0 and 100 to standard

input until you input "stop", at which point it should print your average to standard output.
Computers and Technology
1 answer:
Dominik [7]3 years ago
6 0

Answer:

Following are the program in the Python Programming Language.

#declare variables and initialize to 0

s=0

n=0

avg=0

#set the infinite while loop  

while(True):

 #get input from the user

 score=input()

 #set if statement to break loop

 if(score =="stop"):

   break

 #otherwise, perform calculation

 else:  

   n+= 1

   s=s+ int(score)

   avg= s/n

#print average of the input

print ('average: ',avg)

<u>Output</u>:

58

96

34

15

stop

average:  50.75

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, set three variable that is 's' for sum, 'n' for count and 'avg' for average and initialize them to 0.
  • Set the infinite while loop and inside it, set variable 'score' that get input from the user then, set the if conditional statement for break the loop, otherwise we calculate the sum of the user input and calculate its average.
  • Finally, we print the result with message.
You might be interested in
Janelle went to update the last name for one of her group contacts. She double-clicked on the contact, changed the last name, an
Ivanshal [37]
Janelle should have clicked Save & Close to close the contact.
5 0
3 years ago
Read 2 more answers
Which of these options highlights the need for learning algorithms
LiRa [457]

Answer: D.

Explanation:

7 0
3 years ago
Read 2 more answers
Why is it important to think about the programming language to use?
Sloan [31]
In think is C or B in my opinion
6 0
3 years ago
TLE 10 - ICT
Kipish [7]

Answer:

Information And Communication Technology

5 0
3 years ago
A counter is a tool used to measure the number of times people visit a Web site. true or false?
Liono4ka [1.6K]

True.

It doesn't measure unique users, so you can just hit refresh and the counter keeps going up...

5 0
3 years ago
Other questions:
  • HELP I don't understand this
    14·2 answers
  • True or false.the color attribute cannot recognized the hexadecimal code.
    7·2 answers
  • Use the following global structure declaration as an example only. You will need to create your own data structure based on a da
    5·1 answer
  • The standing toe touch is most likely to result in
    15·1 answer
  • Where could an identity thief access your personal information?
    13·1 answer
  • Randy earn $22 per hour. This is an example of
    11·1 answer
  • An invisible path determining the way of travel from one place to another.
    10·1 answer
  • A new attack involves hacking into medical records and then offering these records for sale on the black market. A medical recor
    14·1 answer
  • Xbox one is not turning on and power brick is orange why is that?​
    6·1 answer
  • Does anyone know how to write this right? This is for a coding class and I’m super confused on it.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!