Scope determines the accessibility and validity of an identifier, function or piece of code within a part or whole program.
Python follow naming resolution scope also known as LEGB rule, which are as given below:
• It checks within local environment
• It checks within execution environment
• It checks the global environment
• It checks it built in environment