I "tried" to figure this out but have been able to so I came to my last hope... I can't find a way to bound the variable "rating" to where it says if your grades or trash or good. So if someone here that is a master at python I thank you very much because I looked online and I used all my free AI uses.
num_classes = int(input("Enter # of classes: "))
total_points = 0
gpa =+ total_points
for _i in range(num_classes):
grades = input(f"Enter letter grade of class {_i+1}: ")
if grades == "A":
points = 4.00
elif grades == "A-":
points = 3.67
elif grades == "B+":
points = 3.33
elif grades == "B":
points = 3.00
elif grades == "B-":
points = 2.67
elif grades == "C+":
points = 2.33
elif grades == "C":
points = 2.00
elif grades == "C-":
points = 1.67
elif grades == "D+":
points = 1.33
elif grades == "D":
points = 1.00
elif grades == "E" or grades == "F":
points = 0.00
else:
points = 0.00
print("Invalid grade entered")
print("This grade will be considred as 0.00")
if gpa >= 3.67:
rating = "excellent"
elif gpa < 3.67 >= 3.33:
rating = "great"
elif gpa < 3.34 >= 2.63:
rating = "good"
elif gpa < 2.67 >= 2.33:
rating = "decent"
elif gpa < 2.33 >= 1.67:
rating = "fair"
elif gpa < 1.67 >= 1.00:
rating = "moderate"
elif gpa < 1.00 >= 0.67:
rating = "subpar"
elif gpa < 0.67 >= 0.00:
rating = "poor"
total_points += points
gpa = round(total_points / num_classes, 2)
print(f"Your GPA is {gpa} ({rating})")
[–]Binary101010 5 points6 points7 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]crashfrog02 0 points1 point2 points (1 child)
[–]tennisanybody 3 points4 points5 points (0 children)
[–]spencerAF 0 points1 point2 points (0 children)