hierarchy of numeric progressions as second example of the use of inheritancewe develop hierarchy of classes for iterating numeric progressions numeric progression is sequence of numberswhere each number depends on one or more of the previous numbers for examplean arithmetic progression determines the next number by adding fixed constant to the previous valueand geometric progression determines the next number by multiplying the previous value by fixed constant in generala progression requires first valueand way of identifying new value based on one or more previous values to maximize reusability of codewe develop hierarchy of classes stemming from general base class that we name progression (see figure technicallythe progression class produces the progression of whole numbers howeverthis class is designed to serve as the base class for other progression typesproviding as much common functionality as possibleand thereby minimizing the burden on the subclasses progression arithmeticprogression geometricprogression fibonacciprogression figure our hierarchy of progression classes our implementation of the basic progression class is provided in code fragment the constructor for this class accepts starting value for the progression ( by default)and initializes data memberself currentto that value the progression class implements the conventions of python iterator (see section )namely the special next and iter methods if user of the class creates progression as seq progression)each call to next(seqwill return subsequent element of the progression sequence it would also be possible to use for-loop syntaxfor value in seq:although we note that our default progression is defined as an infinite sequence to better separate the mechanics of the iterator convention from the core logic of advancing the progressionour framework relies on nonpublic method named advance to update the value of the self current field in the default implementationadvance adds one to the current valuebut our intent is that subclasses will override advance to provide different rule for computing the next entry for conveniencethe progression class also provides utility methodnamed print progressionthat displays the next values of the progression