Lesson 4: Grades using if ... elif ...
Post date: Oct 27, 2017 2:59:31 PM
total = input("How many questions total?:")
answered = input("Correct answers:")
score = (int(answered) / int(total)) * 100
print (score, "%")
grade = "F"
if score == 100:
grade = "A+"
elif score >= 94:
grade = "A"
elif score >= 90:
grade = "A-"
elif score >= 87:
grade = "B+"
elif score >= 84:
grade = "B"
elif score >= 80:
grade = "B-"
elif score >= 77:
grade = "C+"
elif score >= 74:
grade = "C"
elif score >= 70:
grade = "C-"
elif score >= 67:
grade = "D+"
elif score >= 64:
grade = "D"
elif score >= 60:
grade = "D-"
print("Your grade is:",grade)