Python Basics — Day 17 Local vs Global Variables & Scope
01. Local Variables
Declared inside a function
Exist only while the function is running
def show_number():
x = 10 # Local variable
print("Inside function:", x)
show_number()
# print(x) # Error! (x is not defined outside the function)...
sabinsim.hashnode.dev2 min read