Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python variable scope

a = 5

def f1():
  a = 2
  print(a)
  
print(a)   # Will print 5
f1()       # Will print 2
Source by www.codecademy.com #
 
PREVIOUS NEXT
Tagged: #python #variable #scope
ADD COMMENT
Topic
Name
3+1 =