Dancers ======= We have information about *swing and blues dancers* in two dictionaries: - The first one, let's call it ``dni_D``, associates to the DNI (:class:`str`) of a dancer, a list with the personal info of the dancer, which consists of two :class:`str`: the name, and the city of residence. - The second one, let's call it ``dni_dan_D``, associates the DNI (:class:`str`) of a dancer to the list of dances he/she likes. For example, .. literalinclude:: gen_dances_D-test.txt :language: python3 :start-after: --input-ini :end-before: --input-fi Notice that the dancers represented in these two dict are **not** necessarily the same. Implement the following functions in the module :mod:`dancers.py` (file :file:`dancers.py`): .. note:: The grade weight of the fist function is 80% and the second is 20%. Generate Dances Dict -------------------- .. py:function:: gen_dances_D(dni_D, dni_dan_D) such that **given** the :class:`dict` `dni_D` and `dni_dan_D` as described above **returns** a :class:`dict` where the keys are the dance names in `dni_dan_D` and the value for each dance is a list of the dancers that like that dance in t he following format: for each dancer, there is a :class:`tuple` with two components: the dancer name, and the city of residence. In the event that a dni in ``dni_dan_D`` is not a key in ``dni_D``, then this tuple will be composed of its DNI and the ``'?'`` string. Here is an example: .. literalinclude:: gen_dances_D-test.txt :language: python3 :start-after: --output-ini :end-before: --output-fi Notice that, since DNI ``'666Z'`` is not found in ``dni_D``, it appears in the resulting dict as the tuple ``('666Z', '?')`` in the list associated to ``'Lindy_Hop'``. You will find more tests in the :download:`gen_dances_D-test.txt ` file. Sort Dances Dict ---------------- .. py:function:: sort_dances_D(D) such that **given** `D`, a :class:`dict` as the one produced by the previous function **modifies** `D` such that all the lists of tuples with dancers info are ordered as follows: firstly by alphabetically by its city, and secondly, those from the same city are alphabetically ordered by its name. Here is an example doctest: .. literalinclude:: sort_dances_D-test.txt :language: python3 :start-after: --sort-ini :end-before: --sort-fi You will find more tests in the :download:`sort_dances_D-test.txt ` file.