Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Ryerson Letter Grade by yuwai
# feel free to change table structure in any way
TABLE = '''
A 85-89%
A- 80-84%
B+ 77-79%
B 73-76%
B- 70-72%
C+ 67-69%
C 63-66%
C- 60-62%
D+ 57-59%
D 53-56%
D- 50-52%
'''
def ryerson_letter_grade(pct: int) -> str:
letters=["A+","A","A-","B+","B","B-","C+","C","C-","D+","D","D-","F"]
grades=[90,85,80,77,73,70,67,63,60,57,53,50,0]
for i in range(len(grades)):
if pct>=grades[i]:
return letters[i]
if __name__ == '__main__':
print("Example:")
print(ryerson_letter_grade(45))
# These "asserts" are used for self-checking and not for an auto-testing
assert ryerson_letter_grade(45) == "F"
assert ryerson_letter_grade(62) == "C-"
print("Coding complete? Click 'Check' to earn cool rewards!")
Sept. 17, 2019