python Learning Day 5 - Advanced Functions

Local variables and global variables 
in the code below, old_price, rite global variables, final_price for local variables

 

 

Globals () declare a global variable, the function may be modified within the outer variable function

 

 

Built-in functions: function among nested functions

Closure: 
closure condition
1 defines a function within an outer function.
2 function in the use of temporary variables outside the function.
3 and the external function returns a reference to the function value.

 

Guess you like

Origin www.cnblogs.com/w-6711/p/11774369.html