found true elsei + if foundprint('at index'ielseprint( 'not found' :\book\testspython power py at index as isthe example doesn' follow normal python coding techniques follow the steps outlined here to improve it (for all the transformationsyou may either type your code interactively or store it in script file run from the system command line --using file makes this exercise much easier) firstrewrite this code with while loop else clause to eliminate the found flag and final if statement nextrewrite the example to use for loop with an else clauseto eliminate the explicit list-indexing logic (hintto get the index of an itemuse the list index method-- index(xreturns the offset of the first in list nextremove the loop completely by rewriting the example with simple in operator membership expression (see for more detailsor type this to test in [ , , finallyuse for loop and the list append method to generate the powers-of- list (linstead of hardcoding list literal deeper thoughtse do you think it would improve performance to move the * expression outside the loopshow would you code thatf as we saw in exercise python includes map(functionlisttool that can generate powers-of- listtoomap(lambda *xrange( )try typing this code interactivelywe'll meet lambda more formally in the next part of this bookespecially in would list comprehension help here (see ) code maintenance if you haven' already done soexperiment with making the code changes suggested in this sidebar "changing pydoc' colorson page much of the work of real software development is in changing existing codeso the sooner you begin doing sothe better for referencemy edited copy of pydoc is in the book' examples packagenamed mypydoc pyto see how it differsyou can run file compare (fc on windowswith the original pydoc py in (also includedlest it change radically in as the sidebar describesif pydoc is more easily customized by the time you read these wordscustomize the documentation interlude