Bisect solution in Clear category for Ryerson Letter Grade by Sarina
from bisect import bisect
bounds = [50,53,57,60,63,67,70,73,77,80,85,90]
grades = ['F','D-','D','D+','C-','C','C+','B-','B','B+','A-','A','A+']
def ryerson_letter_grade(pct: int) -> str:
return grades[bisect(bounds, pct)]
if __name__ == '__main__':
# 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!")
May 22, 2020