working with functions here is another example say you have program with ten different functions and the program has to decide at runtime which function to use one solution is to use ten if statements shorter solution is to use list of functions the example below assumes that we have already created functions that each take two arguments funcs [ num eval(input'enter number')funcs[num](( , )functions as arguments to functions say we have list of -tuples if we sort the listthe sorting is done based off of the first entry as belowl [( , )( , )( , )( , ) sort([( )( )( )( )suppose we want the sorting to be done based off the second entry the sort method takes an optional argument called keywhich is function that specifies how the sorting should be done here is how to sort based off the second entrydef comp( )return [ [( , )( , )( , )( , ) sort(key=comp[( )( )( )( )here is another examplewhere we sort list of strings by lengthrather than alphabetically 'this ''is '' ''test ''of ''sorting ' sort(key=len[' ''is''of''this''test''sorting'one other place we have seen functions as arguments to other functions is the callback functions of tkinter buttons anonymous functions in one of the examples abovewe passed comparison function to the sort method here is the code againdef comp( )return [ sort(key=compif we have really short function that we're only going to use oncewe can use what is called an anonymous functionlike below