Class representatives ===================== Save all functions into the same file named ``representatives.py``. The students of a class have chosen their class representative. Votes have been stored in a list where each element is one vote: a student name. Write the following functions: .. py:function:: votes_cand(lvotes, lcand) Given a :class:`list` of votes, ``lvotes``, and a :class:`list` of the possible candidate names, ``lcand``, (all students in the class), returns a dictionary (:class:`dict`). In this dictionary, keys are all possible candidates and values are the number of votes that each candidate has obtained. In addition, the dictionary must have the key ``'null'`` that will have the number of null votes as value, i.e., the votes that do not correspond to any candidate. For example: .. literalinclude:: test-votes_cand.txt :language: python :lines: 3- .. Note:: More tests are provided in :download:`test-votes_cand.txt`. .. py:function:: quant_votes(dvotes, name) Given a dictionary such as that obtained by function :py:func:`votes_cand`, and a name of a candidate (:class:`str`), return a :class:`tuple` with a Boolean (:class:`bool`) and an integer (:class:`int`). If the candidate name is in the given dictionary, the Boolean will be ``True`` and the integer will be the number of votes that this candidate has obtained; otherwise, the Boolean will be ``False`` and the integer ``-1``. .. literalinclude:: test-quant_votes.txt :language: python :lines: 3- .. Note:: More tests are provided in :download:`test-quant_votes.txt`. .. py:function:: percent_null(dvotes) Given a dictionary such as that obtained by function :py:func:`votes_cand`, return the percentage of null votes with respect to the total votes (:class:`float`). Suppose that there is at least one vote in the dictionary. For example, .. literalinclude:: test-percent_null.txt :language: python :lines: 3- .. Note:: More tests are provided in :download:`test-percent_null.txt`. .. py:function:: win(dvotes) Given a dictionary such as that obtained by function :py:func:`votes_cand`, returns a :class:`list`, sorted alphabetically, with the names of the winners, i.e., those candidates who have obtained the maximum number of votes. The list will have more than one element in case of a tie. For example, .. literalinclude:: test-win.txt :language: python :lines: 3- .. Note:: More tests are provided in :download:`test-win.txt`. .. rubric:: Solution A solution is provided in the :download:`representatives.py `.