Objects ======= Let's consider a dictionary with information about a number of objects with the following format: - The keys are 2-component :class:`tuple`: - the name of the object (:class:`str`) - the identification number (:class:`int`) - The values are 3-component :class:`list`: - a color (:class:`str`) - a number of items (:class:`int`) - a price (:class:`float`) For example: .. literalinclude:: list_objects.test :language: pycon :start-after: --ini-in :end-before: --fi-in You are required to deliver the following functions in the module :mod:`objects` (file :file:`objects.py`). ------------------------------------------------------------------------------------------------ The first function is: .. py:function:: list_objects(objD) such that **given** *objD*, a :class:`dict` as described above **returns** a new :class:`list` of 5-component :class:`tuple` whith all the information of that object in the key and value order, namely: the name of the object (:class:`str`), the id number (:class:`int`), the color (:class:`str`), the number of items (:class:`int`) and the price (:class:`float`). For example: .. literalinclude:: list_objects.test :language: pycon :start-after: --ini-out :end-before: --fi-out .. warning:: This function must be implement using **comprehension lists**. Doctests are available in the :download:`list_objects.test` file. ------------------------------------------------------------------------------------------------ The second function is: .. py:function:: sort_objects(L) such that **given** *L*, a :class:`list` as the output of the previous function (described above) **returns** a **new** :class:`list` with the same tuples but ordered according to the following criteria (listed in decreasing priority): #. The color, alphabetically. #. The numbrer of items, increasingly. #. The price, decreasingly. For example: .. literalinclude:: sort_objects.test :language: pycon :start-after: --ini-out :end-before: --fi-out .. warning:: This input list **must not** be modified by the function. Doctests are available in the :download:`sort_objects.test` file.