Scientific Computing with Python - More Conditional Structures ex 3.3

when placing my code in the autograder on the PY4E website, I’m returning the right value with my code but still receiving an error message. any help would be greatly appreciated. The question and my code are below.

Exercise 3: Write a program to prompt for a score between 0.0 and
1.0. If the score is out of range, print an error message. If the score is
between 0.0 and 1.0, print a grade using the following table:
3.11. EXERCISES 41
Score Grade

= 0.9 A
= 0.8 B
= 0.7 C
= 0.6 D
< 0.6 F

Code
sc = input("Enter Score: ")
try:
sc = float(sc)
except:
print(“Enter score between 0.0 - 1.0”)
quit()
#print(sc)

if sc >= 0.9 and sc <= 1.0 :
print("Grade: A ")
elif sc >= 0.8 and sc < 0.9 :
print("Grade: B ")
elif sc >= 0.7 and sc < 0.8 :
print("Grade: C ")
elif sc >= 0.6 and sc < 0.7 :
print("Grade: D ")
elif sc >= 0.0 and sc < 0.6 :
print("Grade: F ")
else:
print(“Enter score between 0.0 - 1.0”)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.