Run
class Student: def __init__(self, name, age, country): self.name = name self.age = age self.country = country student1 = Student('Mike', 12, 'Canada') if hasattr(student1, 'age') : print('The object has specified attribute.') else : print('The object does not have specified attribute.')
Output