+ 5
A global variable exists everywhere in the program after it is declared. If you made this function: def func: x = 5 # new variable return x #function definition ends print(x) #this does not work because x only exists inside the function. That is a not a global variable because it only exists inside the function. A global variable is not declared inside a function and can be used anywhere after it is declared.
10th Feb 2018, 4:32 PM
Jacob Pembleton
Jacob Pembleton - avatar