Currencies ========== Save all functions into the same file named :file:`currencies.py`. We define a first string format as: ``amount currency`` where ``amount`` does not contain decimals, ``currency`` always contains three characters and where the separation between ``amount`` and ``currency`` is always a single whitespace. Example: '235 EUR' We define a second string format as: ``employee_type:amount currency`` where ``employee_type`` is a single character meaning: 'D' (managing director), 'P' (project manager) or 'T' (technician), ``amount`` does not contain decimals, ``currency`` always contains three characters and where the separation between ``employee_type`` and ``amount`` is always a colon and the separation between ``amount`` and ``currency`` is a single whitespace. Example: 'D:230 EUR' #. Write function :py:func:`extract_currency` that takes a string in the first format, and returns a new string with the currency. If the given string is empty, it returns also an empty string. Example: .. literalinclude:: test-currencies1.txt :language: python3 :lines: 3- .. note:: More tests are provided in file :download:`test-currencies1.txt ` #. Write function :py:func:`extract_amount` that takes a string in the first format, and returns the corresponding amount (``int``). If the given string is empty, it returns -1. Example: .. literalinclude:: test-currencies2.txt :language: python3 :lines: 3- .. note:: More tests are provided in file :download:`test-currencies2.txt ` #. Write function :py:func:`employee_cost` that takes a string in the second format, and returns a ``float`` with the cost amount in euros, taking into account that when the employee is a managing director, the returning cost is 0.0. There are only two possible currencies other than euros, 'USD' and 'AUD' and the fix conversion to be applied will be: 1USD = 0.9EUR and 1AUD = 0.65EUR. This function must call the two previous functions :py:func:`extract_currency` and :py:func:`extract_amount`. Example: .. literalinclude:: test-currencies3.txt :language: python3 :lines: 3- .. note:: More tests are provided in file :download:`test-currencies3.txt ` #. Write function :py:func:`convert_cost` that takes a string in the second format, and returns another string with the following format: ``amount EUR`` where ``amount`` is the integer part of the amount in the given string, converted to euros, taking into account that when the employee is a managing director, the returning cost is 0.0. There are only two possible currencies other than euros, 'USD' and 'AUD' and the fix conversion to be applied will be: 1USD = 0.9EUR and 1AUD = 0.65EUR. This function must call the previous one :py:func:`employee_cost`. Example: .. literalinclude:: test-currencies4.txt :language: python3 :lines: 3- .. note:: More tests are provided in file :download:`test-currencies4.txt ` .. rubric:: Solution A solution of these functions is provided in file :download:`currencies.py `