Answers for "local var py"

1

python local variables

'''Local variables are those that are defined in a block '''
a = 1 #This is NOT a local variable, this is a global variable
def add():
  b = 1 #This IS a local variable
  print(b)
add()
#If we tried to print(b) outside of the add() function, we would get an error
Posted by: Guest on August-06-2020

Code answers related to "local var py"

Python Answers by Framework

Browse Popular Code Answers by Language