Python variable scope

Your video will begin in 10
69 Views
Published
Python variable scope tutorial example explained

#python #variable #scope

# ========================================================
# scope = The region that a variable is recognized
# A variable is only available from inside the region it is created.
# A global and locally scoped versions of a variable can be created

name = "Bro" # global scope (available inside & outside functions)

def display_name():
name = "Code" # local scope (available only inside this function)
print(name)


display_name()
print(name)
# ========================================================

Bro Code merch store
Category
Bro Code
Tags
Python, python, python scope
Be the first to comment