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 Moff
import re
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%
F 0-49%
'''
def ryerson_letter_grade(pct: int) -> str:
for c, a, b in re.findall('(?m)(.+?)\s(\d+)-(\d+)%$', TABLE):
if int(a) <= pct <= int(b):
return c
return "A+"
Oct. 25, 2018