116 CHAPTER7. CONTROLSTRUCTURES,PART 1
7.5.4 Strategy4:UsePython.
Beforeleavingthisproblem,I reallyshouldmentionthatnoneofthealgorithmdevelopmentwehave so
painstakinglypursuedwasnecessary. Pythonactuallyhasa built-infunctioncalledmaxthatreturns the
largestofitsparameters.Hereis thesimplestversionofourprogram.
def main():
x1, x2, x3 = input("Please enter three values: ")
print "The largestvalue is", max(x1, x2, x3)
Ofcourse,thisversiondidn’t requireany algorithmdevelopmentat all,whichratherdefeatsthepointofthe
exercise!SometimesPythonis justtoosimpleforourowngood....
7.5.5 SomeLessons
Themaxofthreeproblemisnotparticularlyearthshattering,buttheattempttosolve thisproblemhas
illustratedsomeimportantideasinalgorithmandprogramdesign.