0
‘Calculator’ is a blueprint(Class) for an object.
In order to use the function in the blueprint you have to create an object with that blueprint(class)
class Calculator:
def __init__(self,n1,n2):
self.n1=n1
self.n2=n2
def add(self):
return (self.n1+self.n2)
n1 = int(input())
n2 = int(input())
x = Calculator(n1, n2)
print(x.add())
In this case the object ‘x’ was created with ‘Calculator’ class, and was able to use the add() function in the ‘Calculator’ class