Preview:
# This program will convert a given mark to its corresponding grade:
# 1. Take user inputs:


mark = input("Ënter a mark between 0 to 100: ")

# repeat the process until the user enter q
while mark != 'q':
    mark=int(mark)
    if mark>100 or mark<0:
        print("Mark Invalid")
    elif mark>=0 and mark<= 49:
        print(f"Grade for {mark} is N (Fail)")
    elif mark>=50 and mark<= 59:
        print(f"Grade for {mark} is P (Pass)")
    elif mark>=60 and mark<= 69:
        print(f"Grade for {mark} is C (Credit)")
    elif mark>=70 and mark<= 79:
        print(f"Grade for {mark} is D (Distinction)")
    else:
        print(f"Grade for {mark} is HD (High Distinction)")
# get a new mark:
    mark = input("Ënter a mark between 0 to 100: ")
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