Ternary operations
Format:
Variable = condition Returns true result of the IF condition else condition returns false
Condition: 1, must have the result. 2, there must be if. 3, can only be a simple result
Namespaces and scopes for functions built-in namespaces:--python interpreter
The Python interpreter is the first name that can be used when it is started stored in the built-in namespace, and the built-in name is loaded into memory when the interpreter is started.
Global namespaces:--The code we write, but not the code in the function
is the process of executing from top to bottom of the program loaded into memory, and placed all of our set of variable name and function name.
Local namespaces:--functions
is the name defined inside the function, which produces the namespace when the function is called, and the namespace disappears as the function executes.
Order of loading and taking values between three namespaces:
Load order: Built-in namespaces (program run full load)--Global namespace (program run: Load from top to bottom)--local namespace (program running: Call is load only)
Value:
Built-in namespaces, local namespaces, and global namespaces, local call spaces
x = 1def F (x): Print(x)print(10)
Global invocation: Built-in namespaces, global namespaces
x = 1def F (x): Print(x) F (ten)print(x)
Local: You can use names in global, built-in namespaces
in global: You can use names in built-in namespaces, but not in local
in Built-in: cannot use local and global names
Python ()