LEARN PYTHON NOW! Book: The Pillars of Python. #15 — The Scope:

“You never know how strong you are, until being strong is the only option you have left.” Bob Marley

The term Scope in programming refers to the scope of the variables in our program. A distinction is made between:

Global scope, which affects the entire program.
Local scope, which affect within a function.

For example:

def suma(a,b): 
print ("Scope local:",a+b)
print ("Scope global:", a+b)
Photo by Markus Spiske on Unsplash

It is very important to understand what we have just done to gain more basic programming fundamentals. The key is in a=10, which is within the “sum” function so it is considered local and only affects what is within this function.

— — — — — — — — — — — — — — The End — — — — — — — — — — — — —

If you like this small and free magazine you can help us by simply sharing it or subscribing to the publication. My name is Rubén Ruiz and I work in Artificial Intelligence in the financial industry and as a personal project I run this little magazine where we experiment with Artificial Intelligence… until the computer explodes :) You can follow me on:

Instagram (Personal life, it’s fun) => @rubenruiz_t

Youtube (Channel about AI, try to make it fun )=> Rubén Ruiz A.I.

Github (Where I upload my code, this is not so much fun anymore) => RubenRuizT

Source: Deep Learning on Medium