callednot the value of the variable when the function was defined (this is called "late binding"this means if you want to use the value variable has when the function is createdyou need to save the current value of that variable whereas python uses "late bindingby defaultthe alternative that newcomers often expect is "early binding"where function uses the value variable had when the function was definedcan be easily implemented consider the following programs designed to create list of functionswhere the ith function in the list is meant to add to its argument: pythondemo py -some tricky examples fun_list [for in range( )def fun ( )return + fun_list append(fun fun_list [for in range( )def fun ( ,iv= )return +iv fun_list append(fun fun_list [lambda ee+ for in range( ) fun_list [lambda ,iv=ie+iv for in range( ) = try to predictand then test to see the outputof the output of the following callsremembering that the function uses the latest value of any variable that is not bound in the function callpythondemo py -(continued in shell do #ipython - pythondemo py try these (copy text after the comment symbol and paste in the python prompt)print([ ( for in fun_list ]print([ ( for in fun_list ]print([ ( for in fun_list ]print([ ( for in fun_list ]in the first for-loopthe function fun uses iwhose value is the last value it was assigned in the second loopthe function fun uses iv there is separate iv variable for each functionand its value is the value of when the function was defined thus fun uses late bindingand fun uses early binding fun list numbered lines are python code available in the code-directoryaipython the name of the file is given in the gray text above the listing the numbers correspond to the line numbers in that file version june