Grade (2) X84310


Statement
 

pdf   zip

html

Write a function grade(s) that given a float score s such that 0≤ s ≤ 10 returns the grade string that corresponds to s. The result of the function has to stick to the catalan grading rules: when s is less than 5 the grade is ’suspens’, when s is at least 5 but less than 7 the grade is ’aprovat’, when s is at least 7 but less than 9 is ’notable’, when s is at least 9 but less than 10 is ’excel.lent’ —note that the dot is the usual one— and finally, if s is 10 the grade is ’MH’.

Sample session
>>> grade(4.99)
'suspens'
>>> grade(8)
'notable'
>>> grade(6.99)
'aprovat'
>>> grade(9.5)
'excel.lent'
>>> grade(10)
'MH'
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python