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 = TrueCheat 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 descriptiveTry it yourself
This lesson doesn't include a code challenge.
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Logical Operators Part 48Loops
For LoopWhile LoopBreakContinueRecap - FactorialThe Range FunctionNested LoopRecap - Dynamic Input3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators9Functions
Declare a FunctionArgumentsReturnRecap - Sigma FunctionRecap - Validation FunctionDefault Values12Iterating Over Sequences
Iterating Over ElementsThe Enumerate FunctionIterating Over Strings Part 1Iterating Over Strings Part 2