naming variables | python scope in 2022

Опубликовано: 17 Октябрь 2024
на канале: Coding Study Point
198
like

Naming Variables
If you operate with the same variable name inside and outside of a function, Python will treat them as two separate variables, one available in the global scope (outside the function) and one available in the local scope (inside the function)
The function will print the local x, and then the code will print the global x