get principal and interest rate principal eval(input("enter the initial principal")apr eval(input("enter the annualized interest rate")create graphics window with labels on left edge win graphwin("investment growth chart" win setbackground("white"win setcoords(- ,- text(point(- ) 'draw(wintext(point(- ) 'draw(wintext(point(- ) 'draw(wintext(point(- ) 'draw(wintext(point(- )' 'draw(windraw bar for initial principal bar rectangle(point( )point( principal)bar setfill("green"bar setwidth( bar draw(windraw bar for each subsequent year for year in range( )principal principal ( aprbar rectangle(point(year )point(year+ principal)bar setfill("green"bar setwidth( bar draw(wininput("press to quit "win close(main(this is certainly workable programbut there is nagging issue of program style that really should be addressed notice that this program draws bars in two different places the initial bar is drawn just before the loopand the subsequent bars are drawn inside of the loop having similar code like this in two places has some drawbacks obviouslyone issue is having to write the code twice more subtle problem is that the code has to be maintained in two different places should we decide to change the color or other facets of the barswe would have to make sure these changes occur in both places failing to keep related parts of the code in sync is common problem in program maintenance functions can be used to reduce code duplication and to make programs more understandable