Welcome

sampleqa.in tutorials, Python Programming  tutorial,Python Variable Scope Basics

Python Variable Scope Basics


     Variables declared and defined in the Program , has scope associated with in. Namespace is a place variables have reference in it. Variables can be declared outside the function,variables as function parameters, variables declared with in the function,variables declared with in the nested functions, variables in the class attributes.

Variables has following scope
  • Local Scope
  • Nested Scope
  • Global Scope
  • built-in scope

Note:

A class is never used as a global scope

ADS