Boolean29. The numbers \(x, y, x_1, y_1, x_2, y_2\) are given. Check the truth of the statement: "The point with the coordinates \((x, y)\) lies inside the rectangle which top left vertex has the coordinates \((x_1, y_1)\), the lower right one is \((x_2, y_2)\) and the sides are parallel to the coordinate axes."

Solution in Python 3:

import random

x1,x2 = sorted(random.sample(range(-10, 11), 2))
y2,y1 = sorted(random.sample(range(-10, 11), 2))
x = random.randrange(-10,11)
y = random.randrange(-10,11)
b = (x1 < x) and (x < x2) and (y2 < y) and (y < y1)
print("Vertex (x1, y1): ({0},{1})".format(x1, y1))
print("Vertex (x2, y2): ({0},{1})".format(x2, y2))
print("Point (x, y): ({0},{1})".format(x, y))
print("The point lies inside the rectangle: ",b)