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
1. What are the advantages and disadvantages of technology in communication?
Gennadij [26K]

Answer:

ADVANTAGES:

First, the evolution of technology is beneficial to humans for several reasons. At the medical level, technology can help treat more sick people and consequently save many lives and combat very harmful viruses and bacteria.

2-Technology has also increased the productivity of almost every industry in the world. Thanks to technology, we can even pay with bitcoins instead of using banks

DISADVANTAGES:

1-Lack of Privacy. You might think that a quick text or IM offers more privacy than a telephone call in a crowded room. ...

2-Distraction from Real Life. ...

3-Potential for Misunderstanding. ...

4-Decline of Grammar and Spelling...

5- Near people are far and far people are near through communication technology. we have no time to sit with our relatives but constantly communicate far away people . I think this is biggest <em>disadvantage </em>

Explanation:

7 0
3 years ago
Read 2 more answers
My current lesson is The Excel Screen and Worksheets and the question is:
Usimov [2.4K]
I can't tell you the answer without a picture, but to find the answer yourself: Go straight up from the cell containing 'Activity Questions' this will tell you a letter such as B. Go directly across to the left of the cell containing 'Activity Questions' this will tell you a number such as 3. The name of the cell I used as an example would be called B3.
3 0
3 years ago
Look at the top 3 banking activities done via mobile banking vs. online banking. What characteristics do you notice for both?
muminat

Answer:  <em>The biggest difference between the two is their functionality. Internet Banking allows you to conduct online transactions through your PC or laptop and an internet connection. On the other hand, mobile banking can be done with or without internet. Many banks nowadays have their mobile apps for mobile banking.</em>

Disadvantages of Mobile Banking

<em>If the customer does not have a smartphone than the use of Mobile Banking becomes limited. A transaction like transfer of funds is only available on high-end phones. Regular use of Mobile Banking may lead to extra charges levied by the bank for providing the service.</em>

<em />

Explanation: <u><em>Was this helpful to you? if so please put me Brainlyest.</em></u>

4 0
3 years ago
You are about to install a new USB camera on your Linux system and you realize that there is no device special file available fo
Nonamiya [84]

Answer:

mknod

Explanation:

When the user wants to configure a camera device on his Linux computer and the user recognizes that his device does not have a device-specific file. Thus, the user could use the mknod command on his computer to set up an equipment file because it is the command that is used to create a fresh file and these files are not the same as the normal file.

So, the following answer is correct according to the following scenario.

3 0
3 years ago
Sam's take-home pay is $743. His deductions are $25 for OASDI, $5 for Medicare, and $27 for income tax. What is his gross pay? A
Katarina [22]

<u>Answer:</u>

A. $686.00

<u>Reasoning:</u>

25+5+27=57 So the total amount of the deductions is $57

Subtract 57 from 743

743 - 57 = 686

So he is left with 686

5 0
3 years ago
Other questions:
  • A new company is upgrading a media workstation. The computer will be predominantly used for graphic intensive presentations, sli
    13·1 answer
  • . Dеclarе a onе-dimеnsional array of 30 doublеs (on thе stack) namеd rainfall
    11·1 answer
  • WHICH OF THE FOLLOWING LOOKS JUST LIKE A CD ROM BUT CAN STORE MUCH MORE INFORMATION
    8·2 answers
  • Which routine is configured to be called by another routine?
    10·1 answer
  • Intuitively, which of the following would happen to e⃗ net if d became very large?
    6·1 answer
  • A user complains that his computer automatically reboots after a short period of time. Which of the following computer component
    13·1 answer
  • The OSI model is a useful tool in troubleshooting a network because it enables you to isolate a problem to a particular software
    11·1 answer
  • How do you close a file?
    12·2 answers
  • Complete the sentence about entering and editing data in a cell in a spreadsheet.
    13·1 answer
  • If you notice that a worksheet displays columns A, B, C, E, and F, what happened to column D?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!