LEGB rule in Python—a key concept that defines how variable names are resolved based on scope. Whether you're a beginner or an intermediate Python programmer, understanding the LEGB rule will help you master how Python handles variable lookups across different scopes.