diff --git a/Program's_Contributed_By_Contributors/VariableScope.py b/Program's_Contributed_By_Contributors/VariableScope.py new file mode 100644 index 0000000000..22387dda65 --- /dev/null +++ b/Program's_Contributed_By_Contributors/VariableScope.py @@ -0,0 +1,12 @@ + +x = 'Global x' + +def test(): + #global x + y = 'Local y' + x = 'Local x' + print(x +', '+ y) #prints 'Local x' and 'Local y' + +if __name__ == '__main__': + test() + print(x) #prints 'Global x' \ No newline at end of file