209k views
2 votes
Write a grading program for a class with the following grading policies: a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores. They should be converted to a percentage before they are averaged in.) Any grade of 90 or more is an A, any grade of 80 or more (but less than 90) is a B, any grade of 70 or more (but less than 80) is a C, any grade of 60 or more (but less than 70) is a D, and any grade below 60 is an F.

User Noli
by
5.0k points

1 Answer

5 votes

Answer:

# Prompt the user to enter the score for first quiz

quiz1 = int(input("Enter your score for first quiz: "))

# Prompt the user to enter the score for second quiz

quiz2 = int(input("Enter your score for second quiz: "))

# Prompt the user to enter the score for midterm exam

midterm_exam = int(input("Enter your score for the mid term exam: "))

# Prompt the user to enter the score for final exam

final_exam = int(input("Enter your score for the final exam: "))

# sum of first and second quiz is assigned to total_quiz

total_quiz = quiz1 + quiz2

# the two quiz are normalized as 25%

normalized_quiz = (total_quiz / 20) * 25

# the midterm_exam is normalized as 25%

normalized_midterm_exam = (midterm_exam / 100) * 25

# the final_exam is normalized as 50%

normalized_final_exam = (final_exam / 100) * 50

# the total score is calculated by summing all normalized score

total_grade = normalized_quiz + normalized_midterm_exam + normalized_final_exam

# if-else block that compare the total grade

# and output the corresponding letter

# It output A if total_grade >= 90 and <= 100

# It output B if total_grade < 90 and >= 80

# It output C if total_grade < 80 and >= 70

# It output D if total_grade < 70 and >= 60

# It output F if total_grade < 60

if(total_grade >= 90 and total_grade <= 100):

print("Your score is: ", total_grade, " and your grade is A.")

elif(total_grade < 90 and total_grade >= 80):

print("Your score is: ", total_grade, " and your grade is B.")

elif(total_grade < 80 and total_grade >= 70):

print("Your score is: ", total_grade, " and your grade is C.")

elif(total_grade < 70 and total_grade >= 60):

print("Your score is: ", total_grade, " and your grade is D.")

elif(total_grade < 60):

print("Your score is: ", total_grade, " and your grade is F.")

Step-by-step explanation:

The program is written in Python and well-commented. A sample image of program output is attached.

Write a grading program for a class with the following grading policies: a. There-example-1
User Keimeno
by
4.5k points