Scope

TheΒ 
scope
Β 
ofΒ 
aΒ 
variableΒ 
meansΒ 
theΒ 
blockΒ 
ofΒ 
theΒ 
programΒ 
whereΒ 
youΒ 
canΒ 
useΒ 
thatΒ 
variable.
TheΒ 
variableΒ 
isΒ 
onlyΒ 
availableΒ 
fromΒ 
insideΒ 
theΒ 
region
Β 
itΒ 
isΒ 
created,Β 
thisΒ 
isΒ 
calledΒ 
theΒ 
scopeΒ 
ofΒ 
theΒ 
variable.

Global Variable

YouΒ 
canΒ 
useΒ 
aΒ 
globalΒ 
variable
Β 
anywhereΒ 
insideΒ 
yourΒ 
program,Β 
evenΒ 
insideΒ 
functions.
var_name
def function_name():
    print(var_name)
num1 = 1
num2 = 2
def add():
    print(num1+num2)
add()

Local Variable

TheΒ 
scopeΒ 
ofΒ 
aΒ 
local
Β 
variable
Β 
isΒ 
limitedΒ 
onlyΒ 
toΒ 
thatΒ 
particularΒ 
block.Β 
For
Β 
example
,Β 
aΒ 
variableΒ 
declaredΒ 
inΒ 
aΒ 
functionΒ 
canΒ 
onlyΒ 
beΒ 
usedΒ 
inΒ 
thatΒ 
particularΒ 
function.Β 
AΒ 
functionΒ 
cannot
Β 
useΒ 
theΒ 
localΒ 
variablesΒ 
fromΒ 
otherΒ 
functions.