Menu
Coddy logo textTech

Naming Conventions

Part of the Fundamentals section of Coddy's Python journey — lesson 7 of 77.

Naming conventions are a set of guidelines that developers follow to make their code more readable and maintainable. Different programming languages often have different naming conventions. In python, variables are written in snake case - words are separated by underscores.

When writing a variable name be descriptive and use meaningful words

For example 

# Bad Naming
isActive = False # not snake case
a = 10
b = "Hello"
x = True

# Good Naming
age = 10
greeting = "Hello"
is_active = True

Cheat sheet

Python variable naming conventions:

  • Use snake_case: words separated by underscores
  • Be descriptive and use meaningful words
# Good examples
age = 10
greeting = "Hello"
is_active = True

# Bad examples
isActive = False  # not snake case
a = 10  # not descriptive

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals