Skip to main content

2 docs tagged with "Variables"

View all tags

Scope: Local, Enclosing, Global, and Built-in (LEGB Rule)

We've been working with variables and functions, but we haven't yet discussed a crucial concept: scope. Scope determines the visibility and accessibility of a variable. In other words, it answers the question, "Where in my program can I access this variable?" Understanding scope is essential for writing bug-free code and avoiding common errors where variables seem to "disappear" or have unexpected values.

Variables and Assignment

Following our exploration of Your First Python Script variables. We'll learn how to create and use variables in Python, and the best practices for naming them.