I need an error message to display to the user if they try to enter a score over 100 and I need to use the sys.exit() to exit the program gracefully if any errors are detected. I need to do this in an if statement. I can't figure this out, I'm a total noob. Help please..
name = input("Please enter your First and Last Name: ")
score = int(input("Enter your first exam score: "))
score2 = int(input("Enter your second exam score: "))
score3 = int(input("Enter your third exam score: "))
average = (score + score2 + score3) // 3
if average >= 100:
print("Error")
sys.exit()
elif average >= 90 and average <= 100:
print("You received an A.")
elif average >= 80 and average < 90:
print("You received a B.")
elif average >= 70 and average < 80:
print("You received a C.")
elif average >= 60 and average < 70:
print("You received a D.")
else:
print("You received an F.")
print("Report Card")
print("Name:", name)
print("You scored a", score, "on your first exam.")
print("You scored a", score2, "on your second exam.")
print("You scored a", score3, "on your third exam.")
print("Your average score is" ,average,"percent.")
