Boxes ===== We represent a two-dimensional point in Python with a tuple. It has two components which reperesent the ``x`` and ``y`` coordinates (real or integer). We also represent a two-dimensional orthogonal rectangle with a tuple. It has two components which reperesent its bottom left and top right vertices, respectively, as points. Save the following functions into a file named ``rectangles.py``. #. Write the function :py:func:`point_inside_rect` that takes a two-dimensional point and an orthogonal rectangle, and returns ``True`` if the point in inside the rectangle and ``False`` otherwise. Points on the rectangle boundary are considered interior. See the following examples: .. literalinclude:: test-point_inside_rect.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-point_inside_rect.txt` file. #. Write the function :py:func:`rect_number` that takes a two-dimensional point and a list of orthogonal rectangles, and returns the number of rectangles that contain this point. This function **must call** the first one. See the following examples: .. literalinclude:: test-rect_number.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-rect_number.txt` file. #. Write the function :py:func:`rectangle_cont` that takes a two-dimensional point and a list of orthogonal rectangles, and returns the first rectangle in the list which contains the given point. If there is no such rectangle, the function must return a rectangle with both points equal to the given one. This function **must call** the first one. See the following examples: .. literalinclude:: test-rectangle_cont.txt :language: python3 :lines: 3- .. note:: More tests are provided in the :download:`test-rectangle_cont.txt ` file #. Write the function :py:func:`rectangles` that takes a two-dimensional point and a tuple of orthogonal rectangles, and returns another tuple with all the rectangles in the given tuple that contain the given point. The rectangles in the returned tuple must be in the same order as in the given one. This function **must call** the first one. See the following examples: .. literalinclude:: test-rectangles.txt :language: python3 :lines: 2- .. note:: More tests are provided in the :download:`test-rectangles.txt ` file .. rubric:: Solution A solution of these functions is provided in file :download:`rectangles.py `,