1.给定两个坐标轴对齐的矩形,判断他们是否相交,如果相交,给出他们所形成的矩形。
class Rectangle(object):
#构造函数要求输入左下角坐标以及宽和高
def __init__(self,x,y,width,height):
self.x = x
self.y = y
self.w = width
self.h = height
def isInterset(self,r):
if self.x <= r.x+r.w and r.x <= self.x + self.w and self.y <= r.y +r.h and r