Preview:
while True:
    try:
        marks = int(input("Enter your marks 0 to 100 to see your grade: "))
    except ValueError:
        print('Invalid input, try again')
        continue
    else:
        break
if marks > 100:
    print('Invalid marks')   
elif marks > 90 < 100:
    print('Grade A')
elif marks > 80 <= 90:
    print('Grade B')
elif marks >= 60 <= 80:
    print('Grade C')
elif marks < 60:
    print('Grade D')
else:
    print('You have failed')
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter