Rectangle in rectangle X58214


Statement
 

pdf   zip

html

Using the definitions

class Point: """attributes: x, y""" class Rectangle: """attributes: width, height, corner"""

and the function point_in_rectangle from problem X53379 (Point in rectangle), write a function

rectangle_in_rectangle(r1, r2)

that returns True if all of the corners of a rectangle r1 fall inside a rectangle r2, and False otherwise. For example, a rectangle of width 50, height 100, and lower-left corner (25, 25) falls inside a rectangle of width 100, height 200, and lower-left corner (0, 0), but a rectangle of width 50, height 100, and lower-left corner (0, 0) does not.

Input

The input consists of several pairs of rectangles (four non-negative integer numbers for each: the width, the height, and the coordinates of the lower-left corner).

Output

For each pair of rectangles, print whether or not the first rectangle fall inside the second rectangle.

Public test cases
  • Input

    50 100 25 25 100 200 0 0
    50 100 0 0 100 200 0 0
    

    Output

    True
    False
    
  • Information
    Author
    Gabriel Valiente
    Language
    English
    Official solutions
    Python
    User solutions
    C++ Python