that triggers an error automatically)but in general it' better to assume that arguments will work in your functionscode and let python raise errors for you when they do not bonus points you can get bonus points here for changing these functions to compute the maximumrather than minimumvalues this one' easythe first two versions only require changing and the third simply requires that we return tmp[- instead of tmp[ for an extra pointbe sure to set the function name to "maxas well (though this part is strictly optionalit' also possible to generalize single function to compute either minimum or maximum valueby evaluating comparison expression strings with tool like the eval built-in function (see the library manualand various appearances hereespecially in or passing in an arbitrary comparison function the file minmax py shows how to implement the latter schemedef minmax(test*args)res args[ for arg in args[ :]if test(argres)res arg return res def lessthan(xy)return def grtrthan(xy)return see alsolambdaeval print(minmax(lessthan )print(minmax(grtrthan )self-test code python minmax py functions are another kind of object that can be passed into function like this one to make this max (or otherfunctionfor examplewe simply pass in the right sort of test function this may seem like extra workbut the main point of generalizing functions this way--instead of cutting and pasting to change just single character--is that we'll only have one version to change in the futurenot two the punch line of courseall this was just coding exercise there' really no reason to code min or max functionsbecause both are built-ins in pythonwe met them briefly in in conjunction with numeric toolsand again in when exploring iteration contexts the built-in versions work almost exactly like oursbut they're coded in for optimal speed and accept either single iterable or multiple arguments still arguments