#Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error.
#If the score is between 0.0 and 1.0, print a grade using the following table:
#Score Grade >= 0.9 A >= 0.8 B >= 0.7 C >= 0.6 D < 0.6 F
#If the user enters a value out of range, print a suitable error message and exit. For the test, enter a score of 0.85.
sc = input("Enter score: ")
score = float(sc)
try:
score >=0.0 and score <= 1.0
except:
print("A value is out of range")
quit()
if score >= 0.9 :
print("A")
elif score >= 0.8 :
print("B")
elif score >= 0.7 :
print("C")
elif score >= 0.6 :
print("D")
else :
print("F")
수업에서 다루지는 않았지만 문제가 있어서 풀어봤는데 1.5를 넣어도 계속 A가 나오는 이유가 뭘까요?
comment