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
failed logins or instances of denial of access to restricted files may be indicators of compromise. suggest where records of suc
algol [13]

As forensic evidence of suspected intrusions on a host system or network, indicators of compromise (IOCs) are used.

<h3>What is indicators?</h3>

System administrators and information security (InfoSec) experts can identify malicious activity such as intrusion attempts using these artifacts. IOCs are used by security researchers to more thoroughly examine the methods and behaviour of a certain malware.

IOCs also offer useful threat intelligence that can be disseminated around the community to help organizations develop their incident response and remediation plans.

Some of these artifacts can be seen on the system's event logs, time-stamped entries, apps, and services. Various tools that monitor IOCs are also used by infosec experts and IT/system administrators to help mitigate, if not stop, breaches or assaults.

Therefore, As forensic evidence of suspected intrusions on a host system or network, indicators of compromise (IOCs) are used.

To learn more about indicators, refer to the link:

brainly.com/question/28093573

#SPJ1

4 0
1 year ago
What science category includes physics and biology?
enyata [817]

Answer:

Physical science is the study of the inorganic world. That is, it does not study living things. (Those are studied in biological, or life, science.) The four main branches of physical science are astronomy, physics, chemistry, and the Earth sciences, which include meteorology and geology.

5 0
2 years ago
Does anyone know a working free spotify premium on ios 2021 plz i have had any luck finding anything:(​
natima [27]
No sorry

................
5 0
2 years ago
Read 2 more answers
The primary key is a field that uniquely and completely identifies a record.
Leokris [45]
True

----------------------------------
6 0
3 years ago
Read 2 more answers
_________________ uses soap or detergent to physically remove germs, dirt, and impurities from surfaces or objects.
ra1l [238]

Answer:

humans,washing mashines,dish washers

Explanation:

8 0
2 years ago
Other questions:
  • William has an internet connection that does not allow him to make calls when connected to the Internet. What internet service c
    8·2 answers
  • The syntax used for referencing cells with their worksheet names is the sheet name, followed by ____, then the usual column lett
    8·1 answer
  • Which of the following is not a location where text can be entered​
    15·1 answer
  • 1. Write a recursive method to determine if a character is in a list of characters in O(logN) time. Mathematically prove (as we
    13·1 answer
  • You change a document that is saved on your computer by cutting text from the document what happens to the text when you preform
    5·1 answer
  • Which behavior of the application should the user expect? A user profile has login hour restrictions set to Monday through Frida
    12·1 answer
  • What do we call data that's broken down into bits and sent through a network?
    15·1 answer
  • According to programming best practices, how should you handle code that needs to be repeated several times in a program?
    6·1 answer
  • Define the term loop rule.
    13·1 answer
  • Most spyware programs are benign in that they do not perform malicious acts or steal data. group of answer choices true false
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!