Question

In: Computer Science

Python 3.7.4 (Introductory Level) You want to know your grade in Computer Science: Write a program...

Python 3.7.4 (Introductory Level)

You want to know your grade in Computer Science:

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.

Solutions

Expert Solution

Python 3.7.+ standard program to implement the given problem is provided below:

Note: The code indentation may lost while copying, if happens so please refer the screenshot provided to reconstruct the indentation.

Python code:

#the variable to store count

scoresCount = 0

#the variable to store scores sum

scoreSum = 0

#the variable to store the input

inp = ''

#user prompt

print("Please inp the grades one by one, inp 'stop' to quit")

#repeat while input is not stop

while inp != "stop":

    inp = input('Enter the grade:' )

            #if input is not stop and is a number

    if inp != "stop" and inp.isdigit():

                       

                        #add the input grade to the sum

        scoreSum += int(inp)

                       

                        #increment the scores count

        scoresCount = scoresCount +1

#print the average to standard output

print("The average of entered grades is: ")

print (float(scoreSum) / scoresCount)

Output:

Code screenshot:


Related Solutions

Please write in beginner level PYTHON code! Your job is to write a Python program that...
Please write in beginner level PYTHON code! Your job is to write a Python program that asks the user to make one of two choices: destruct or construct. - If the user chooses to destruct, prompt them for an alternade, and then output the 2 words from that alternade. - If the user chooses construct, prompt them for 2 words, and then output the alternade that would have produced those words. - You must enforce that the users enter real...
Programming Python Jupiter notebook Write a Python program that gets a numeric grade (on a scale...
Programming Python Jupiter notebook Write a Python program that gets a numeric grade (on a scale of 0-100) from the user and convert it to a letter grade based on the following table. The program should be written so that if the user entered either a non-numeric input or a numeric input out of the 0-100 range, it asks him/her to enter a numeric input in the correct range, instead of returning an error. Example: Enter your score: 78 Letter...
This document describes a computer program you must write in Python and submit to Gradescope. For...
This document describes a computer program you must write in Python and submit to Gradescope. For this project, the program will simulate the operation of a vending machine that sells snacks, accepting coins and dispensing products and change. In an actual vending machine, a program running on an embedded computer accepts input from buttons (e.g. a numeric keypad) and devices such as coin acceptors, and its output consists of signals that control a display, actuate motors to dispense products, etc.....
You want to write a simple python program for a food delivery company that asks the...
You want to write a simple python program for a food delivery company that asks the office worker how many drivers they require to deliver their packages to different parts of town. When the user enters the number of drivers, the program will ask how many packages each driver will carry to its destination. It will then calculate the total number of packages and display the result on the screen as below. Sample run: How many drivers do you need?...
i want to write research paper in the field of computer science but cant decide the...
i want to write research paper in the field of computer science but cant decide the topic for that plz help me.
You are one of the top students in your university’s computer science program of 200 students....
You are one of the top students in your university’s computer science program of 200 students. You are surprised when you are met after class by two representatives from a federal intelligence agency. Over dinner, they talk to you about the increasing threat of cyberterrorist attacks launched on the United States by foreign countries and the need to counter those attacks. They offer you a position on the agency’s supersecret cyber terrorism unit, at a starting salary 50 percent higher...
home / study / engineering / computer science / computer science questions and answers / write...
home / study / engineering / computer science / computer science questions and answers / write a program that in c++: 1.prompts the user to enter a positive integer, think of this ... Question: Write a program that in C++: 1.Prompts the user to enter a positive integer, think of this intege... Write a program that in C++: 1.Prompts the user to enter a positive integer, think of this integer as representing a specific number of pennies. 2. The program...
Please write in Python 3.7.4 or Higher. The Payroll Department keeps a list of employee information...
Please write in Python 3.7.4 or Higher. The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: <last name> <hours worked> <hourly wage> Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular format with the appropriate header....
In each of the projects that follow, you should write a program that contains an introductory...
In each of the projects that follow, you should write a program that contains an introductory docstring. This documentation should describe what the program will do (analysis) and how it will do it (design the program in the form of a pseudocode algorithm). Include suitable prompts for all inputs, and label all outputs appropri- ately. After you have coded a program, be sure to test it with a reasonable set of legitimate inputs. Q. Write a program that takes as...
In each of the projects that follow, you should write a program that contains an introductory...
In each of the projects that follow, you should write a program that contains an introductory docstring. This documentation should describe what the program will do (analysis) and how it will do it (design the program in the form of a pseudocode algorithm). Include suitable prompts for all inputs, and label all outputs appropri- ately. After you have coded a program, be sure to test it with a reasonable set of legitimate inputs. 5 An object’s momentum is its mass...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT