Replace num1 and num2 with num3 and num4.
class fraction:
def __init__(self,num1,num2,num3,num4):
self.num1=num1
self.num2=num2
self.num3=num3
self.num4=num4
def addition(self):
print(self.num1+self.num2)
return self.num1+self.num2
def sub(self):
print(self.num1+self.num2)
return self.num1+self.num2
def div(self):
print(self.num1/self.num2)
return self.num1/self.num2
def mul(self):
print(self.num1*self.num2)
return self.num1*self.num2
def reminder(self):
print(self.num1%self.num2)
return self.num1%self.num2
if __name__ =="__main__":
object=fraction(1,2,3,4)
object.addition()
object.reminder()
0
solved Creating a class in python with several methods [closed]