Candidates ========== A *votes dictionary* is a dictionary (:class:`dict`) that represents the votes received by the mayor candidates of a municipality. The key of the dictionary is the name and surname of the candidate (:class:`str`), and the value is the number of received votes (:class:`int`). For example: .. code:: python {'Joan Pere Jorbina Palau':570, 'Niceto Brunildo Fornells':679, 'Mariona Puig Peix': 701, 'Adriana de Tor Quemada': 451} An *income dictionary* is a dictionary (:class:`dict`) that represents the annual income of all the people of the municipality. The key of the dictionary is the name and surnames of the person (:class:`str`) and the value is their annual income expressed in euros (:class:`int`). For example: .. code:: python {'Mariona Puig Peix':15456, 'Arnau Osorio Lucas':27654, 'Arnau Brigat Pelfred': 18654, 'Niceto Brunildo Fornells':14567} Save all functions into the same file named ``candidates.py``. .. py:function:: votes_minimum (dic, threshold) Given a votes dictionary as the one described and a threshold (:class:`int`), return a Boolean (:class:`bool`) with a value of ``True`` if all candidates reached a number of votes superior to the given threshold, and ``False`` otherwise. For example, .. literalinclude:: test-votes_minimum.txt :language: python :lines: 3-9 .. note:: More tests are provided in file :download:`test-votes_minimum.txt`. .. py:function:: can_most_voted(dic) Given a votes dictionary as the one described, return the name and surname of the most voted candidate (:class:`str`). If the given dictionary is empty, return an empty string. You can suppose that there are no repeated number of votes. For example, .. literalinclude:: test-can_most_voted.txt :language: python :lines: 3-7 .. note:: More tests are provided in file :download:`test-can_most_voted.txt`. .. py:function:: votes_income(dvotes, dinc) Given a votes dictionary and an income dictionary as the ones described, return a :class:`list` with the names (:class:`str`) of those candidates whom we don't known the income, that is, those candidates that are in the votes dictionary but not in the income dictionary. The returned list must be sorted alphabetically: .. literalinclude:: test-votes_income.txt :language: python :lines: 3-9 .. note:: More tests are provided in file :download:`test-votes_income.txt`. .. py:function:: wealthy(dvotes, dinc) Given a votes dictionary and an income dictionary as the ones decribed, return a :class:`list` with the names (:class:`str`) of the 10 wealthiest people in the municipality. In addition, for each one of these people that is a candidate, we must place an asterisk (``'*'``) next to their name. The list must be sorted from more to less income. Suppose that there are at least 10 people in the municipality. For example, .. literalinclude:: test-wealthy.txt :language: python :lines: 3-25 .. note:: More tests are provided in file :download:`test-wealthy.txt`. .. rubric:: Solutions A solution is provided in file :download:`candidates.py `.