Use Global Variables in Function easily!
-----------------------------------------------------------------------------------------------------------
Global Variables are something defined outside an entity which if needed to be referenced inside it, must be referenced using the "global" keyword.
-----------------------------------------------------------------------------------------------------------
Example:
------------------------------
testvar = 45;
def myfunction():
a = 10;
global testvar;
a = testvar + 10;
print(a);
myfunction();
------------------------------
Here if the "global" keyword is not used, it will throw an error as testvar is not a local variable of the function.
The output is 55.
Download the latest python release here: https://www.python.org/downloads/
Follow me on Instagram: / the_perfect_tutorials
Nesta página do site você pode assistir ao vídeo on-line Refer Global Variables inside a Function | Python Tutorials | Learn Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário The Perfect Tutorials 21 Junho 2018, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 33 vezes e gostou 5 espectadores. Boa visualização!