python' exception hierarchy another example of rich inheritance hierarchy is the organization of various exception types in python we introduced many of those classes in section but did not discuss their relationship with each other figure illustrates (smallportion of that hierarchy the baseexception class is the root of the entire hierarchywhile the more specific exception class includes most of the error types that we have discussed programmers are welcome to define their own special exception classes to denote errors that may occur in the context of their application those user-defined exception types should be declared as subclasses of exception baseexception systemexit exception keyboardinterrupt lookuperror valueerror indexerror arithmeticerror keyerror zerodivisionerror figure portion of python' hierarchy of exception types extending the creditcard class to demonstrate the mechanisms for inheritance in pythonwe revisit the creditcard class of section implementing subclass thatfor lack of better namewe name predatorycreditcard the new class will differ from the original in two ways( if an attempted charge is rejected because it would have exceeded the credit limita $ fee will be chargedand ( there will be mechanism for assessing monthly interest charge on the outstanding balancebased upon an annual percentage rate (aprspecified as constructor parameter in accomplishing this goalwe demonstrate the techniques of specialization and extension to charge fee for an invalid charge attemptwe override the existing charge methodthereby specializing it to provide the new functionality (although the new version takes advantage of call to the overridden versionto provide support for charging interestwe extend the class with new method named process month