Clothes Shop ============ A clothing manufacturing company uses a *stock dictionary* for each shop. In this dictionary (:class:`dict`), each key is a 3-:class:`tuple` with the code, size and color of a model of a piece of clothing (3 :class:`str`) and the value is the number of pieces of this model that are in the shop (:class:`int`). Save all functions into the same file named ``clotheshop.py``. #. Write the **modifier** function :py:func:`stock_increase` that given a stock dictionary, the code (:class:`str`), size (:class:`str`) and color (:class:`str`) of a model, and a number of pieces of this model(:class:`int`), **modifies** the dictionary adding this quantity to the given model. .. literalinclude:: test-shop1.txt :language: python3 :lines: 3- .. note:: More tests are provided in :download:`test-shop1.txt ` #. Write the **modifier** function :py:func:`stock_decrease` that given a stock dictionary, the code (:class:`str`), size (:class:`str`) and color (:class:`str`) of a model, and a number of pieces of this model (:class:`int`), **modifies** the dictionary subtracting this quantity to the given model. We will suppose that there are always enough pieces to subtract the given quantity. .. literalinclude:: test-shop2.txt :language: python3 :lines: 3- .. note:: More tests are provided in :download:`test-shop2.txt ` #. Write the function :py:func:`low_stock` that given a stock dictionary and a threshold (:class:`int`), returns a :class:`list` with those pieces with a stock lower than the given threshold. Each piece in the returnes list is represented with a tuple with the code, size and color. .. literalinclude:: test-shop3.txt :language: python3 :lines: 3- .. note:: More tests are provided in :download:`test-shop3.txt ` #. A *sales list* is a nested list. Each sublist of it has the code, color and size of a model (3 :class:`str`) and the number of sold pieces of this model (:class:`int`). A *restocking list* is similar to a sales list but the amount means the number of restoked models. Write the **modifier** function :py:func:`update_stock` that given a stock dictionary, a sales list, and a restocking list, **modifies** the dictionary subtracting those sales of the first list and adding the restock of the second one. This function must use the previous functions :py:func:`stock_increase` and py:func:`stock_decrease`. .. literalinclude:: test-shop4.txt :language: python3 :lines: 3- .. note:: More tests are provided in :download:`test-shop4.txt ` .. rubric:: Solutions A solution is provided in the :download:`clotheshop.py `.