18. update for the code #9 that calculates the student's grade

PHOTO EMBED

Thu Jan 18 2024 11:01:45 GMT+0000 (Coordinated Universal Time)

Saved by @mwebrania #python

while True:
    try:
        marks = float(input('Enter your marks to calculate your grade: \n'))
    except ValueError:
        print('Invalid input, try again')
        continue
    if marks > 100:
        print('your input must not be greater than 100')
    else:
        break

if 85 <= marks <= 100:
    print('You have grade A')
elif 65 <= marks < 85:
    print('You have grade B')
elif 41 <= marks < 65:
    print('You have grade C')
elif 0 <= marks < 41:
    print('You failed')
else:
    print('Invalid Marks')
content_copyCOPY