Oct-31-2018, 08:14 PM
I am trying to make a python code that contains if/else/elif statements that tells you what your grade is based on your score. So the program should respond according to this score table:
Score Grade
>= 0.9 A
>= 0.8 B
>= 0.7 C
>= 0.6 D
< 0.6 F
I wrote this code, but it keeps giving me a traceback error. I have no idea why and I've tried changing so much. I would appreciate help, thank you!
prompt = input('Enter a score between 0.0 and 0.1:\n')
score = input(prompt)
if score > 1 :
print('Not a valid score')
if score >= 0.9 :
print('A')
if score >= 0.8 :
print('B')
if score >= 0.7 :
print('C')
if score >= 0.6 :
print('D')
if score >= 0.0 :
print('F')
else :
print('Not a valid score')
score = input('Press enter to exit')
Score Grade
>= 0.9 A
>= 0.8 B
>= 0.7 C
>= 0.6 D
< 0.6 F
I wrote this code, but it keeps giving me a traceback error. I have no idea why and I've tried changing so much. I would appreciate help, thank you!
prompt = input('Enter a score between 0.0 and 0.1:\n')
score = input(prompt)
if score > 1 :
print('Not a valid score')
if score >= 0.9 :
print('A')
if score >= 0.8 :
print('B')
if score >= 0.7 :
print('C')
if score >= 0.6 :
print('D')
if score >= 0.0 :
print('F')
else :
print('Not a valid score')
score = input('Press enter to exit')