variable inside class not detecting global variable in python

Solutions on MaxInterview for variable inside class not detecting global variable in python by the best coders in the world

showing results for - "variable inside class not detecting global variable in python"
Loris
10 Jul 2017
1some_global_variable
2
3class TestClass():
4    def run(self):
5        #we can access it by defining the variable as global inside the function
6        global some_global_variable 
7        for i in range(10):
8            some_global_variable = 1
9            print(some_global_variable)