What is an instance variable in Python | Example code

Python Instance variables are variables that have their unique value to a particular instance. The instance variables are owned by an instance (Object) of a class. They are declared inside a class method. Example instance variable in Python Simple example code student class example below, name and age are instance variables: Output: Different ways to Read More…


Python global keyword | Change scope of variables

Python global keyword is used to change the scope of variables. By default variables inside the function has local scope. Means you can’t use it outside the function. Simple use global keyword to read and write a global variable inside a function. Note: If a variable defines outside the funciton it is global by default. Read More…