Students ======== Save all functions into the same file named ``students.py``. To manage the class lists of a school year we use a dictionary :class:`dict` where the key is a 3-tuple with the name and the two surnames of the student (:class:`str`), and the associated value is the :class:`list` of subjects in which they are enrolled. For example, the following dictionary: .. code:: python dic = {('Joan', 'Rubio', 'Boix'): ['Programming', 'Physics', 'Calculus'], ('Anna', 'Pons', 'Adell'): ['Calculus', 'Programming']} contains the student ``Joan Rubio Boix`` enrolled in ``Programming``, ``Physics`` and ``Calculus`` and the student ``Anna Pons Adell`` enrolled in ``Programming`` and ``Calculus``. #. Write the **modifier** function :py:func:`add_student` that given a dictionary as that described, the name and two surnames of a new student (:class:`str`), and a :class:`list` with the subjects in which they are enrolled, **modifies** the dictionary by adding this new student. Examples: .. literalinclude:: test-students1.txt :language: python :lines: 3- .. Note:: More tests are provided in :download:`test-students1.txt`. #. Write the function :py:func:`subject_student` that given a dictionary as that described, and the name and two surnames of a new student (:class:`str`), returns the :class:`list` of subjects in which that student is enrolled. If the student isn't in the dictionary it returns an empty list. Examples: .. literalinclude:: test-students2.txt :language: python :lines: 3- .. Note:: More tests are provided in :download:`test-students2.txt`. #. Write the function :py:func:`listed` that given a dictionary as that described and a subject (:class:`str`), returns the :class:`list` of all the students enrolled in this subject. In this list, a student must be represented with a string following this pattern: the first surname, a space, the second surname, a comma and a space, and the name. The list has to be sorted by the first surname. If no student is enrolled in the given subject, the function will return an empty list. Examples: .. literalinclude:: test-students3.txt :language: python :lines: 3- .. Note:: More tests are provided in :download:`test-students3.txt`. #. Write the function :py:func:`students_per_subject` that given a dictionary as that described, returns another dictionary where the key is the name of a subject, and its associate value is the number of students enrolled in this subject. Examples: .. literalinclude:: test-students4.txt :language: python :lines: 3- .. Note:: More tests are provided in :download:`test-students4.txt`. .. rubric:: Solution A solution is provided in the :download:`students.py`