Grade Computing =============== The context is the process of calculating the final **grade** of a student given his/her grades from 4 CATs and the FINAL exam. This information is received in a single text (:class:`str`) with exactly 5 sentences, each ended by a ``'\n'`` character. The sentences are not necessarily ordered. Each sentence is a text with the following common features: - The **grade** value is always at the end of the sentence, always preceded by one space (``' '``) and inmediately followed by the end of line character ``'\n'``. - The sentences with the cat's grade always include the word ``CAT`` inmediately followed by the number. For instance, ``"My CAT4's grade it's ok: it's 5.0.\n"``. - The sentence with the final exam grade has no ``'CAT'`` substring and has the value of the grade at the end as well. We wish to get a text indicating the *weigthed average grade* corresponding to that student in a sentence like: ``'Your weigthed average grade is 7.05.'`` The weights for the various input grades is as follows: - The CAT's grade is obtained by averaging the CATs grades with the following weights: CAT1 is 10% and the rest is 30%. - The final grade is obtained by the average of CAT grade and Final exam grade (both 50%). ------------------------------------------------------------------------------------------ You are required to deliver the following functions (they have the same grade weight) in the module :mod:`grades_module` (file :file:`grades_module.py`): Firstly, an auxiliar function specified as follows: .. py:function:: grd_xtr(s) such that **given** *s*, a :class:`str` with a sentence with the grade from one exam as described above. **returns** - an :class:`int` with either the number of the CAT in the sentence (hence, 1,2,3 or 4) or 0 if it is the grade from the final exam. - a :class:`float` with the grade For example, .. literalinclude:: grd_xtr.test :language: python3 :start-after: --ini :end-before: --fi Doctests are available in the :download:`grd_xtr.test` file. ------------------------------------------------------------------------------------------ Secondly, the main function: .. py:function:: grd_clc(s) such that **given** *s* a :class:`str` with the text with the five sentences about a student's grades, as described above. **returns** a :class:`str` indicating the final grade of the student in the format described above. The grade must be rounded to 2 decimals. For instance, .. literalinclude:: grd_clc.test :language: python3 :start-after: --ini :end-before: --fi .. warning:: This function must be implemented by calling the previous function. Doctests are available in the :download:`grd_clc.test` file.