Basic Variable scope

Basic Variable scope:

age = 27 # This is known as global scope
print(age)

def increase_age():
	age = 30 # Is this variable the same as the one defined above?
	# No, this is a different variable and is part of local scope
	
print(age) # prints 27
increase_age()
print(age) # still prints 27

Last updated