file.py
class User:
def __init__(self, name, age):
self.usrName = name
self.usrAge = age
def displayAge(self):
print("Age: ", self.usrAge)
obj = User("ABC", 20)
print("Name: ", obj.usrName)
obj.displayAge()
output:
Output
Name: ABC
Age: 20
class User:
def __init__(self, name, age):
self.usrName = name
self.usrAge = age
def displayAge(self):
print("Age: ", self.usrAge)
obj = User("ABC", 20)
print("Name: ", obj.usrName)
obj.displayAge()
output:
Name: ABC
Age: 20