In this program, you will learn how to add two numbers using the default constructor in Python.
self.z = self.a + self.b
class Test:
def __init__(self):
self.a = int(input("Enter first number:"))
self.b = int(input("Enter second number:"))
self.z = self.a + self.b
print("Sum is:", self.z)
obj = Test()
Enter first number:10
Enter second number:20
Sum is: 30