How to combine two class? so the output can be equal...
here's my code..
class year:
def __add__(self, year):
return (year)
class day:
def __add__(self, day):
return (day)
class month:
def __add__(self, month):
return (month)
class Date:
def __call__(self, year, month, day):
return (year, month, day)
class Delta(year, month, day):
def __call__(self, year, month):
return (year, month)
date = Date()
delta = Delta()
print delta(year=5, month=6) + date(2019,5,2)
this code will make output...>>> (5, 6, 2019, 5, 2)
Wrong output..
because, the output must be equal, like this...>>> (2024, 11, 2)
Note: This is my homework, not allowed using import
...
python2.7
thanks before :)