Point in rectangle

Using the definitions

    class Point:
        """attributes: x, y"""

    class Rectangle:
        """attributes: width, height, corner"""

write a function

    point_in_rectangle(p, r)

that returns @inside@ if a point p is inside a rectangle r, @border@ if
p lies on the boundary of r, and @outside@ if p is outside r. For
example, the point (50, 100) is inside a rectangle of width 100, height
200, and lower-left corner (0, 0), the point (100, 200) lies on the
boundary of the rectangle, and the point (200, 300) is outside the
rectangle.

Input

The input consists of several rectangles (four non-negative integer
numbers: the width, the height, and the coordinates of the lower-left
corner), each followed by a point (two non-negative integer numbers).

Output

For each rectangle and point, print @inside@, @border@, or @outside@
according to the point being inside, on the boundary of, or outside the
rectangle.

Problem information

Author: Gabriel Valiente

Generation: 2026-01-25T16:50:34.548Z

© Jutge.org, 2006–2026.
https://jutge.org
