Grade X31005


Statement
 

pdf   zip

html

You have to program the function below.

  • 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’.

Scoring

The function counts 100 points.

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