Is there any way to make area() refer to check()? Currently, codes of check() is the same in area().
class Rectangle:
def __init__(self, x1, y1, x2, y2):
self.x1 = x1
self.x2 = x2
self.y1 = y1
self.y2 = y2
def check(self): #Checking this rectangle
if abs(self.x1-self.x2) == 0 or abs(self.y1-self.y2)==0:
return False
else :
return True
def area(self): #Calculating width
if abs(self.x1-self.x2) == 0 or abs(self.y1-self.y2)==0:
return False
else :
area = abs(self.x1-self.x2)*abs(self.y1-self.y2)
return area