+ 4

Who can tell me about the global variable in python? I want to know about it.

global variable

27th Aug 2018, 4:05 PM
Deshani Malawana.
Deshani Malawana. - avatar
4 Réponses
+ 3
A global variable is a variable declared outside of function ( global scope). This means, global variable can be accessed inside or outside of the function. Variables that are only referenced inside a function are implicitly global. If a variable is assigned a value anywhere within the function’s body, it’s assumed to be a local unless explicitly declared as global. If a variable with same name is defined inside the scope of function then its value will be used and not the global value.
28th Aug 2018, 12:37 AM
Dababi Mohamed Amine
Dababi Mohamed Amine - avatar
+ 2
thank you very much.
28th Aug 2018, 8:14 AM
Deshani Malawana.
Deshani Malawana. - avatar
0
global variable is used anywhere in your page of code and it has to define the outside the function.
8th Sep 2018, 11:51 AM
CHINNEM SUNIL KUMAR
CHINNEM SUNIL KUMAR - avatar
- 4
can you give me your mail
29th Aug 2018, 1:18 PM
Abdelghafour El Bouanani
Abdelghafour El Bouanani - avatar