listing - creating an external class class myclassdef __init__(selfname="sam"age= )self name name self age age def getname(self)return self name def setname(selfname)self name name def getage(self)return self age def setage(selfage)self age age def __str__(self)return "{ is aged { format(self nameself agein this casethe class begins by creating an object with two instance variablesname and age if the user fails to provide these valuesthey default to sam and this example provides you with new class feature most developers call this feature an accessor essentiallyit provides access to an underlying value there are two types of accessorsgetters and setters both getname(and getage(are getters they provide read-only access to the underlying value the setname(and setage(methods are setterswhich provide writeonly access to the underlying value using combination of methods like this allows you to check inputs for correct type and rangeas well as verify that the caller has permission to view the information as with just about every other class you createyou need to define the __str__(method if you want the user to be able to print the object in this casethe class provides formatted output that lists both of the instance variables using the class in an application most of the timeyou use external classes when working with python it isn' very often that class exists within the confines of the application file because the application would become large and unmanageable in addition