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
padilas [110]
3 years ago
11

Write a program to read a list of exam scores given as integer percentages in the range O to 100. Display the total number of gr

ades and the number of grades in each letter-grade category as follows: 90 to 100 is an A , 80 to 89 is a B, 70 to 79 is a C, 60 to 69 is a D, and O to 59 is an F. Use a negative score as a sentinel value to indicate the end of the input. (The negative value is used only to end the loop, so do not use it in the calculations.) For example, if the input is
98 87 86 85 85 78 72 70 66 63 50 -1

The output would be
Total number of grades =14Number of A's =1»Number of B's= 4Number of C's= 6Number of D'S
2Number of F's =1
Computers and Technology
1 answer:
Hitman42 [59]3 years ago
7 0

Answer:

  1. def determineGrade(score):
  2.    if(score >= 90):
  3.        return "A"
  4.    elif(score>=80):
  5.        return "B"
  6.    elif(score>=70):
  7.        return "C"
  8.    elif(score>=60):
  9.        return "D"
  10.    else:
  11.        return "F"
  12. totalGrade = 0
  13. aCount = 0
  14. bCount = 0
  15. cCount = 0
  16. dCount = 0
  17. fCount = 0
  18. user_score = int(input("Enter your score: "))
  19. while(user_score > 0):
  20.    totalGrade += 1
  21.    grade = determineGrade(user_score)
  22.    if(grade == "A"):
  23.        aCount += 1
  24.    elif(grade == "B"):
  25.        bCount += 1
  26.    elif(grade == "C"):
  27.        cCount += 1
  28.    elif(grade == "D"):
  29.        dCount += 1
  30.    else:
  31.        fCount += 1
  32.    user_score = int(input("Enter your score: "))
  33. print("Total number of grades = " + str(totalGrade))
  34. print("Number of A's = " + str(aCount))
  35. print("Number of B's = " + str(bCount))
  36. print("Number of C's = " + str(cCount))
  37. print("Number of D's = " + str(dCount))
  38. print("Number of F's = " + str(fCount))

Explanation:

Firstly, we can define a function <em>determineGrade()</em> that takes one input values, score, and determine the grade based on the letter-grade category given in the question. (Line 1 - 11)

Next, we declare a list of necessary variables to hold the value of total number of grades, and total number of each grade (Line 13 -18). Let's initialize them to zero.

Next, we prompt for user input of the first score (Line 20).

To keep prompting input from user, we can create a while loop with condition if the current <em>user_input</em> is not negative, the Line 22 - Line 35 should keep running. Within the while loop, call the determineGrade() function by passing the current <em>user_input</em> as argument to obtain a grade and assign it to variable <em>grade</em>.  

We develop another if-else-if statements to track the number of occurrence for each grade (Line 26 - 35). Whenever a current <em>grade</em> meet one of the condition in if-else-if statements, one of the counter variables (aCount, bCount... ) will be incremented by one.

By the end of the while-loop, we prompt use for the next input of score.

At last, we display our output using <em>print()</em> function (Line 39 - 44).

You might be interested in
PYTHON 3 CODE HS HELP PLZ
Tju [1.3M]

Answer:

B

Explanation:

It adds the same number over and over again, 'number' times.

This is number*number, a.k.a. number². (squared)

3 0
2 years ago
Dereck works for long hours on his computer. He frequently experiences physical strain by the end of the day because he does not
Anni [7]
I think the answers are B and D!
4 0
3 years ago
Read 2 more answers
What information is displayed in the message header of a received message? Check all that apply.
Aleks04 [339]

Answer:

the subject of the message

the sender's name

the recipient's name

the date and time when the message was received

Explanation:

Various information is displayed in the header of the message of a received message. And they are the subject of the message, which briefs what is there inside the message. And it mentions the sender's name as well as the recipient's name, and finally, the date and the time as well are stated that explains exactly when the message was being received. And all this information is shown in the header of the message.

3 0
3 years ago
Assignment RequirementsYou have been working as a technology associate in the information systems department at Corporation Tech
garik1379 [7]

Answer:

hola me llamos por mi nombre

Explanation:

me gusta la tegnologia

y no e trabajado xq soy estudiamte aun

7 0
3 years ago
Which of the following is not one of the Fatal Four events that cause three out of five construction worker deaths? A. Caught in
k0ka [10]

The answer is D: Struck down.

Options A, B, and C are the most common types of fatal construction accidents in the United States. Falls, electrocutions, being struck by an object, and workers caught in or between things are responsible for over 64% of construction workers death. Among these four events, falls kill most construction workers followed by electrocutions, falling objects, and workers caught in or between things.


5 0
3 years ago
Read 2 more answers
Other questions:
  • A skier provides what in a landscape photograph of a mountain?
    14·2 answers
  • An example of software most commonly associated with productivity software is ____.
    12·1 answer
  • PLEASE HELP POWER POINT:
    8·2 answers
  • Declare an array named a of 10 elements of type int and initialize the elements (starting with the first) to the values 10, 20,
    13·1 answer
  • Which of the following is the shortcut key combination for pasting copied text?
    11·2 answers
  • Electricity fact topic
    10·2 answers
  • Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will take 5 iterations in total, and in every ite
    6·1 answer
  • Can someone explain what Bytes are? I would really like to know.
    5·2 answers
  • Similarities between inline css and internal css​
    6·1 answer
  • Complete the sentence.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!