Functions
Functions
- Parameters are defined within a function, while arguments are provided outside
of it.
- Positional arguments cannot appear after keyword arguments (e.g., `def
func(a=1, b=2, c)` is incorrect, while `def func(c, a=1, b=2)` is correct).
- Recursive functions call themselves during execution.
- Attempting to use a function before its definition results in a `NameError`.
- `None` is not considered a value and should not participate in expressions.
- `None` can be assigned to variables or returned as a result of a function.
- `None` can be used in comparisons to check a variable's state.
- If a function does not explicitly return a value using `return`, it implicitly returns
`None`.
- Variables declared outside functions are accessible within function bodies
unless a local variable of the same name is defined inside the function.
- Variables defined inside a function are scoped only to that function.
**Additional Concepts:**