A Note on Scope and Globals

Let's learn about how scope works in python

Python has the concept of scope just like most programming languages. Scope will tell us when a variable is available to use and where. If we define the variables inside of a function, those variables can only be used inside that function. Once that function ends, they can no longer be used because they are out of scope. Let’s take a look at an example:

Get hands-on with 1400+ tech skills courses.