class CalMultiply():
def multiply(self):
return self.v1*self.v2
class CalDivide():
def divide(self):
return self.v1/self.v2
class Cal(CalMultiply, CalDivide):
def __init__(self, v1, v2):
if isinstance(v1, int):
self.v1 = v1
if isinstance(v2, int):
self.v2 = v2
def add(self):
return self.v1+self.v2
def subtract(self):
return self.v1-self.v2
def setV1(self, v):
if isinstance(v, int):
self.v1 = v
def getV1(self):
return self.v1
c = Cal(100, 10)
print(c.add())
print(c.multiply())
print(c.divide())
Y2xhc3MgQ2FsTXVsdGlwbHkoKToKICAgIGRlZiBtdWx0aXBseShzZWxmKToKICAgICAgICByZXR1cm4gc2VsZi52MSpzZWxmLnYyCmNsYXNzIENhbERpdmlkZSgpOgogICAgZGVmIGRpdmlkZShzZWxmKToKICAgICAgICByZXR1cm4gc2VsZi52MS9zZWxmLnYyCmNsYXNzIENhbChDYWxNdWx0aXBseSwgQ2FsRGl2aWRlKToKICAgIGRlZiBfX2luaXRfXyhzZWxmLCB2MSwgdjIpOgogICAgICAgIGlmIGlzaW5zdGFuY2UodjEsIGludCk6CiAgICAgICAgICAgIHNlbGYudjEgPSB2MQogICAgICAgIGlmIGlzaW5zdGFuY2UodjIsIGludCk6CiAgICAgICAgICAgIHNlbGYudjIgPSB2MgogICAgZGVmIGFkZChzZWxmKToKICAgICAgICByZXR1cm4gc2VsZi52MStzZWxmLnYyCiAgICBkZWYgc3VidHJhY3Qoc2VsZik6CiAgICAgICAgcmV0dXJuIHNlbGYudjEtc2VsZi52MgogICAgZGVmIHNldFYxKHNlbGYsIHYpOgogICAgICAgIGlmIGlzaW5zdGFuY2UodiwgaW50KToKICAgICAgICAgICAgc2VsZi52MSA9IHYKICAgIGRlZiBnZXRWMShzZWxmKToKICAgICAgICByZXR1cm4gc2VsZi52MQpjID0gQ2FsKDEwMCwgMTApCnByaW50KGMuYWRkKCkpCnByaW50KGMubXVsdGlwbHkoKSkKcHJpbnQoYy5kaXZpZGUoKSkK