filmov
tv
MATH0011 video 4: local and global variables

Показать описание
The definition of local and global variables. Local variables aren't available outside the body of the function they belong to. Using global variables inside a function definition can lead to unexpected behaviour - the same function called with the same argument can give different results at different times. Example to show that Python treats an assignment inside a function body as creating a new local variable, not changing a global variable.