177k views
3 votes
Write a code in Python that will can accept grades with decimals and convert them to their equivalent letter grade in the grading scale:

A: 90 - 100
B+: 87-89
B: 80-86
C+: 77-79
C: 70-76
D+ : 67-69
D: 60-66
F: 0-59
Z: Incomplete

User Yehnan
by
5.3k points

1 Answer

3 votes

grade = float(input("Enter your grade: "))

if 89 < grade < 101:

print("A")

elif 86 < grade < 90:

print("B+")

elif 79 < grade < 87:

print("B")

elif 76< grade < 80:

print("C+")

elif 69 < grade < 77:

print("C")

elif 66 < grade < 70:

print("D+")

elif 59 < grade < 67:

print("D")

elif -1 < grade < 60:

print("F")

else:

print("Z")

I hope this helps!

User Arun Karnati
by
5.0k points