0

The location where we can find a variable and also access it if required is called the scope of a variable.

  • Python Local variable: Local variables are those that are initialized within a function and are unique to that function. It cannot be accessed outside of the function.
  • Python Global variables: Global variables are the ones that are defined and declared outside any function and are not specified to any function.
  • Module-level scope: It refers to the global objects of the current module accessible in the program.
  • Outermost scope: It refers to any built-in names that the program can call. The name referenced is located last among the objects in this scope.
Riya Answered question July 7, 2023