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
How to select the entire worksheet?
Archy [21]
Hey there! Hello! 

In an instance of Microsoft Excel 2016, you can select your entire worksheet by using the Ctrl-A shortcut on your keyboard for Windows, or Command-A in the case of a Mac. If you have a standard Windows keyboard, you should have two Ctrl keys on either side of your keyboard. On a standard Mac keyboard, you'll also find that there are two Command keys on either side of your space key. This shortcut applies to other things as well, such as documents in Word. It basically selects everything there is to select. 

I have attached a screenshot of the result of doing Command-A on a blank document. Everything within the bolded green outline is selected – it's typical for the cell you were on to be white instead of your highlight color (which is grey, in my case), and it will be selected, too. 

Hope this helped you out! Feel free to ask me any additional questions if you have any. :-)

7 0
2 years ago
A(n) ___ is an action that causes something to happen.
Luden [163]
Event is an action that causes something to happen
5 0
3 years ago
The amount of memory used by an array depends upon the array's data type and the number of elements in the array. True False
OverLord2011 [107]

Answer:

True

Explanation:

6 0
2 years ago
Create an array to hold the rainfall values. Create a 2nd parallel array (as a constant) to hold the abbreviated names of the mo
Zarrin [17]

Answer:

#include <stdio.h>

int main()

{

//variable declaration

int low, high;

float lowRain, highRain, total, avg;

 

//array declaration

float rainfall[13];

char monthName[13][10] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

//get user input

for(int i=1; i<=12; i++)

{

printf("Enter the rainfall (in inches) for %s: ", monthName[i]);

scanf("%f", &rainfall[i]);

}

 

//display the monthly rainfall

printf("\nThe rainfall that was entered was:\n");

for(int i = 1; i<=6; i++)

printf("%s ", monthName[i]);

printf("\n");

for(int i = 1; i<=6; i++)

printf("%.1f ", rainfall[i]);

printf("\n");

for(int i = 7; i<=12; i++)

printf("%s ", monthName[i]);

printf("\n");

for(int i = 7; i<=12; i++)

printf("%.1f ", rainfall[i]);

 

//variable initialization

low = 1;

high = 1;

lowRain = rainfall[1];

highRain = rainfall[1];

total = 0;

 

//calculate the lowest, highest and averaage rainfall

for(int i=1; i<=12; i++)

{

if(lowRain>rainfall[i])

{

lowRain = rainfall[i];

low = i;

}

if(highRain<rainfall[i])

{

highRain = rainfall[i];

high = i;

}

total = total + rainfall[i];

}

 

avg = total / 12;

 

//display the result

printf("\n\nThe total rain that fell was %.1f inches", total);

printf("\nThe average monthly rainfall was %.1f inches.", avg);

printf("\nThe lowest monthly rainfall was %.1f inches in %s.", rainfall[low], monthName[low]);

printf("\nThe highest monthly rainfall was %.1f inches in %s.", rainfall[high], monthName[high]);

return 0;

}

4 0
3 years ago
We need goku and naruto fight story someone
lana [24]

Answer:

goku comes in and turns super sayain  naruto come in with kurama and naruto get goku with a rasagen and geku is still fist fightin while naruto is using his kurama and turns into kurama and knocks out goku now naruto thinks he won and goku IS HITIN HIM WITH A KAMEKAMEHA GOKU IS SIROUS NOW

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • WILL DO A BRAINLY! help pls.
    15·1 answer
  • Which of these symbols is a special character that is accessible only from the Symbol dialog box? A. © B. + C. é D.
    13·2 answers
  • The operating system of a computer is an example of ________ software. science-forum
    7·1 answer
  • 4. Who developed the first design technology program which had a
    12·1 answer
  • An application with which you can perform calculations on numbers and work with other data
    8·1 answer
  • What are some benefits of 3-D printing?
    9·1 answer
  • Tara and Zach are leading a systems development project and they want the investigation phase to go smoothly and quickly. They d
    10·1 answer
  • What are specific and relevant terms that will help you locate information using an internet search engine?
    10·1 answer
  • Definition of digital
    9·2 answers
  • Define a function that will return the length of a list
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!