1.2.3 Naming Conventions (snake_case)
Naming conventions define how variables should be named to keep code readable and consistent.
Python follows widely accepted community standards.
snake_case Naming Style
The recommended naming style for variables and functions in Python is snake_case.
Characteristics of snake_case:
- All lowercase letters
- Words separated by underscores (
_) - Clear and descriptive names
Valid Variable Names
A valid Python variable name:
- Starts with a letter or underscore
- Contains only letters, numbers, and underscores
- Is case-sensitive
Naming Best Practices
- Use meaningful names that describe the variable’s purpose
- Avoid single-letter names except in simple loops
- Do not use Python keywords as variable names
- Prefer clarity over brevity
📌 Note:
Good naming makes code easier to understand, debug, and maintain — especially in larger projects.