Python program - It must show the correct final grade debug the code: subjects = ["Math", "English", "Science", "TLE", "Economics", "Filipino", "Laws", "History"] avg_scores = [] # stores the average scores of each subjects sum_of_avg_scores = 0 # sum of the average scores of each subject total = 100 * len(subjects) # total score for i in range(0, len(subjects)): sum_scores = 0 print("Enter the 4 exam scores of " + subjects[i] + ".(Total point per exam is 100)") for j in range(4): score = int(input()) if 0 <= score <= 100: sum_scores += score else: print("Enter a valid number. ") exit(0) avg_scores.append(sum_scores / 4) sum_of_avg_scores += avg_scores[i] print("The average score of " + subjects[i] + " is: " + str(avg_scores[i])) avg_scores = sum_of_avg_scores / len(subjects) # average scores of each subject final_grade = avg_scores / total * 62.5 * 37 # grade formula if 98 <= final_grade <= 100: print("The final grade is 1.00 .") elif 94 <= final_grade <= 97: print("The final grade is 1.25 .") elif 90 <= final_grade <= 93: print("The final grade is 1.50 .") elif 88 <= final_grade <= 89: print("The final grade is 1.75 .") elif 85 <= final_grade <= 87: print("The final grade is 2.00 .") elif 83 <= final_grade <= 84: print("The final grade is 2.25 .") elif 80 <= final_grade <= 82: print("The final grade is 2.50 .") elif 78 <= final_grade <= 79: print("The final grade is 2.75 .") elif 75 <= final_grade <= 77: print("The final grade is 3.00 .") else: print("The final grade is 5.00 .")
Python program
- It must show the correct final grade
debug the code:
subjects = ["Math", "English", "Science", "TLE", "Economics", "Filipino", "Laws", "History"]
avg_scores = [] # stores the average scores of each subjects
sum_of_avg_scores = 0 # sum of the average scores of each subject
total = 100 * len(subjects) # total score
for i in range(0, len(subjects)):
sum_scores = 0
print("Enter the 4 exam scores of " + subjects[i] + ".(Total point per exam is 100)")
for j in range(4):
score = int(input())
if 0 <= score <= 100:
sum_scores += score
else:
print("Enter a valid number. ")
exit(0)
avg_scores.append(sum_scores / 4)
sum_of_avg_scores += avg_scores[i]
print("The average score of " + subjects[i] + " is: " + str(avg_scores[i]))
avg_scores = sum_of_avg_scores / len(subjects) # average scores of each subject
final_grade = avg_scores / total * 62.5 * 37 # grade formula
if 98 <= final_grade <= 100:
print("The final grade is 1.00 .")
elif 94 <= final_grade <= 97:
print("The final grade is 1.25 .")
elif 90 <= final_grade <= 93:
print("The final grade is 1.50 .")
elif 88 <= final_grade <= 89:
print("The final grade is 1.75 .")
elif 85 <= final_grade <= 87:
print("The final grade is 2.00 .")
elif 83 <= final_grade <= 84:
print("The final grade is 2.25 .")
elif 80 <= final_grade <= 82:
print("The final grade is 2.50 .")
elif 78 <= final_grade <= 79:
print("The final grade is 2.75 .")
elif 75 <= final_grade <= 77:
print("The final grade is 3.00 .")
else:
print("The final grade is 5.00 .")