Answers for "variable inside class not detecting global variable in python"

1

variable inside class not detecting global variable in python

some_global_variable

class TestClass():
    def run(self):
        #we can access it by defining the variable as global inside the function
        global some_global_variable 
        for i in range(10):
            some_global_variable = 1
            print(some_global_variable)
Posted by: Guest on April-03-2021

Code answers related to "variable inside class not detecting global variable in python"

Python Answers by Framework

Browse Popular Code Answers by Language