See Python PEP 8: Function and Variable Names:

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Variable names follow the same convention as function names.

mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.

Answer from S.Lott on Stack Overflow
🌐
W3Schools
w3schools.com › python › python_variables_names.asp
Python - Variable Names
Python Examples Python Compiler ... Python Interview Q&A Python Training ... A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume)....
🌐
Python
peps.python.org › pep-0008
PEP 8 – Style Guide for Python Code | peps.python.org
Names of type variables introduced in PEP 484 should normally use CapWords preferring short names: T, AnyStr, Num.
🌐
Real Python
realpython.com › python-variables
Variables in Python: Usage and Best Practices – Real Python
April 15, 2026 - In Python, variables are symbolic names that refer to objects or values stored in your computer’s memory. They allow you to assign descriptive names to data, making it easier to manipulate and reuse values throughout your code.
🌐
Reddit
reddit.com › r/learnpython › is there a standard in naming your variables?
r/learnpython on Reddit: Is there a standard in naming your variables?
February 12, 2024 -

Hello!
How do you name your variables? Is there a standard?
I used to name my variables something like "firstNumber = 5" and constants like "MAX_SPEED = 200".
The problem I noticed is that when I look for those variables they are hard to spot on sight.
As such, I decided to write my next programs using notations like "number_of_items = 25".
I feel like using "_" is much more readable that using "numberOfItems = 25" that can look similar to "typesOfItems = 10"

🌐
Reddit
reddit.com › r/python › follow these rules to write python variables names like a pro.
r/Python on Reddit: Follow these rules to write PYTHON variables names like a PRO.
September 20, 2022 -
  • We have to agree that variables names are an essential part of the source code and meaningful names are important when it comes to program comprehension.

  • They serve as an implied documentation that should convey to the reader;

  • Considering that sometimes names are the only documentation, then clean code approach should be highly regarded.

  • Therefore, it is important to devote a considerable amount of time to the issue of variable naming and therefore the variable names and rules.

Variable Names Rules & Guidelines

  • A variable name CAN be one word, though not a Must

  • You SHOULD separate words with underscores and not spaces.

  • When naming variable's we SHOULD only use alpha-numeric characters (letters and numbers) and the underscore character.

  • You SHOULD NOT start a variable name with a number, but can start with a letter or an underscore character. Breaking this rule will give you an invalid decimal literal or syntax error

  • A variable name SHOULD start with a letter or the underscore character.

  • You SHOULD NOT use python keywords and function names as variable names.

  • Variable names are case sensitive message, Message, MESSAGE and MeSsAge are different

  • Ensure that variable names are; Short: though they can be long. Descriptive: That is can tell what the variable is used for.

  • Take note that some letters like lowercase l and uppercase letter O can easily be confused with number 1 and 0.

  • While it is legal to use upper case letters; Others think it is a good idea to start variable names with lower case letter. Others believe that they better use camel case than separate names with_ . Others avoid starting variables names with an underscore, unless when they are writing library code.

References and further reading.

Watch this for code examples

🌐
Codefinity
codefinity.com › courses › v2 › 2f60173b-9829-4c84-8548-85bf65183f71 › 984eb7ed-25b1-40e1-93d0-3f7991547ac9 › 9078d240-0669-41e4-a40c-9e4538c36fad
Learn Variable Naming Rules | Variables and Types
Variable names should only contain letters, numbers, and underscores. For example, item_name1 is fine, but avoid using special characters like dashes (item-name is invalid). Python treats uppercase and lowercase letters as different.
🌐
PyCoderHub
pycoderhub.com › home › python pep guidelines › python variable naming rules and conventions (pep 8 explained with real-world examples)
Python Variable Naming Rules & Conventions – PEP 8 Explained with Real-World Examples
January 24, 2026 - In this section, we’ll go through each rule in detail, look at valid and invalid examples, understand why the rule exists, and see how it affects real-world Python code. Rule 1: Variable Names Must Start with a Letter or Underscore
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-variables
Python Variables - GeeksforGeeks
1name = "Error" # Starts with a digit class = 10 # class is a reserved keyword user-name = "Doe" # Contains a hyphen · 1. Basic Assignment: Variables are assigned values using the = operator.
Published: May 22, 2026
🌐
Fiveable
fiveable.me › lists › python-variable-naming-conventions
Python Variable Naming Conventions
This distinguishes variables from classes, which use CamelCase—mixing them up signals inexperience to code reviewers · All uppercase with underscores signals immutability—names like MAX_CONNECTIONS or API_TIMEOUT tell other programmers "don't change this" Python doesn't enforce constants ...
🌐
Medium
medium.com › @rowainaabdelnasser › python-naming-conventions-10-essential-guidelines-for-clean-and-readable-code-fe80d2057bc9
Python Naming Conventions: 10 Essential Guidelines for Clean and Readable Code | by Rowaina Abdelnasser | Medium
December 8, 2024 - It is crucial to choose a naming style that aligns with your project’s conventions and stick to it consistently. For variables and functions, use lowercase with underscores (snake_case).
🌐
Stack Abuse
stackabuse.com › python-naming-conventions-for-variables-functions-and-classes
Python Naming Conventions for Variables, Functions, and Classes
August 30, 2023 - Python's variable naming convention is based on the principle of "readability counts", one of the guiding philosophies of Python. A variable name in Python should be descriptive and concise, making it easy for anyone reading your code to understand what the variable is used for.
🌐
Dive into Python
diveintopython.org › home › learn python programming › variables in python
Variable in Python - Variable Types, Definition, Naming Convention
May 3, 2024 - If a variable name consists of more than one word, use underscores to separate them. For example, first_name is a better variable name than firstname · Avoid using reserved keywords. Python has reserved keywords that have special meaning in the language, such as if, else, while, and for.
🌐
Geo-python
geo-python.github.io › site › notebooks › L1 › gcp-1-variable-naming.html
Good coding practices - Selecting “good” variable names — Geo-Python site documentation
Again, if we consider the examples from the previous section, we might consider the variable name fmiStationID or simply stationID if we elect to use camelCase. As mentioned in point 1, pothole_case_naming is preferred, mostly because we feel it is the easiest to read and seems to be most common amongst Python programmers.
🌐
Temzee
temzee.com › python-for-beginner-data-scientists › variable-naming-rules-and-conventions-python
Python Variable Naming Rules and Conventions - Temzee
Variables in Python can only be made up of letters, numbers, and underscores. Variable names cannot start with a number. Reserved Keywords cannot be used as variable names. Variables are case sensitive, and should follow the snake_case convention.
🌐
Linode
linode.com › docs › guides › python-variables
Getting Started with Python Variables | Linode Docs
April 4, 2023 - Python variables support three popular naming conventions: Camel case, where the first letter is lowercase and each subsequent word in a name begins with an uppercase letter.
🌐
Luis Llamas
luisllamas.es › home › courses › python programming course
Rules for naming variables in Python
November 20, 2024 - Name Start: The variable name must start with a letter (a-z, A-Z) or an underscore (_). It must not start with numbers or other characters. variable = 42 _private_variable = "Python" 1variable = "Error" # Incorrect, should not start with a number
🌐
Medium
medium.com › python-mastery-101 › the-art-of-naming-variables-in-python-best-practices-bccfd77ca1b6
The Art of Naming Variables in Python: Best Practices | by Dante Taviantz | Create Everything Python | Medium
September 21, 2023 - 2. userHomeAddress — While Python allows you to use camelCase for variable names, it’s not the most common convention in Python.
🌐
Devcamp
bottega.devcamp.com › full-stack-development-javascript-python › guide › python-best-practices-variable-naming-style
Python Best Practices for Variable Naming and Style
Name is self-explanatory because it is only one word. However, whenever you have a variable that has multiple words such as post count, the common convention is to put an underscore in between the words. This is because another developer may look at your code or you could build a package for someone else to use. When doing so, you want to be able to use the standard conventions that other Python developers are using because, if not, it may look as so: