sort(key=lambda xx[ ]the lambda keyword indicates that what follows will be an anonymous function we then have the arguments to the functionfollowed by colon and then the function code the function code cannot be longer than one line we used anonymous functions back when working with guis to pass information about which button was clicked to the callback function here is the code againfor in range( )for in range( ) [ ][jbutton(command lambda = , =jfunction( , ) recursion recursion is the process where function calls itself one of the standard examples of recursion is the factorial function the factorialn!is the product of all the numbers from up to for instance * * * * alsoby convention recursion involves defining function in terms of itself notice thatfor example !and in generalnn ( )so the factorial function can be defined in terms of itself here is recursive version of the factorial functiondef fact( )if == return elsereturn *fact( - we must specify the case or else the function would keep calling itself forever (or at least until python generates an error about too many levels of recursionnote that the math module has function called factorialso this version here is just for demonstration note also that there is non-recursive way to do the factorialusing for loop it is about as straightforward as the recursive waybut faster howeverfor some problems the recursive solution is the more straightforward solution herefor exampleis program that factors number into prime factors def factor(numl=[])for in range( ,num// + )if num% == return +[ ]+factor(num//ireturn +[numthe factor function takes two argumentsa number to factorand list of previously found factors it checks for factorand if it finds oneit appends it to the list the recursive part is that it divides the number by the factor that was found and then appends to the list all the factors of that value on the other handif the function doesn' find any factorsit appends the number to the listas it must be primeand returns the new list