class fixed(mortgage)def __init__(selfloanrmonths)mortgage __init__(selfloanrmonthsself legend 'fixedstr( * '%class fixedwithpts(mortgage)def __init__(selfloanrmonthspts)mortgage __init__(selfloanrmonthsself pts pts self paid [loan*(pts/ )self legend 'fixedstr( * '%'str(ptspointsclass tworate(mortgage)def __init__(selfloanrmonthsteaserrateteasermonths)mortgage __init__(selfloanteaserratemonthsself teasermonths teasermonths self teaserrate teaserrate self nextrate / self legend str(teaserrate* )'for str(self teasermonths)monthsthen str( * '%def makepayment(self)if len(self paid=self teasermonths self rate self nextrate self payment findpayment(self owed[- ]self rateself months self teasermonthsmortgage makepayment(selffigure subclasses of mortgage figure contain functions that can be used to generate plots intended to provide insight about the different kinds of mortgages the function plotmortgages generates appropriate titles and axis labels for each plotand then uses the methods in mortgageplots to produce the actual plots it uses calls to pylab figure to ensure that the appropriate plots appear in given figure it uses the index to select elements from the lists morts and styles in way that ensures that different kinds of mortgages are represented in consistent way across figures for examplesince the third element in morts is variablerate mortgage and the third element in styles is ' :'the variable-rate mortgage is always plotted using blue dotted line the function comparemortgages generates list of different mortgagesand simulates making series of payments on eachas it did in it then calls plotmortgages to produce the plots