Python variable names must follow certain rules:

  • Variable names must start with a letter or an underscore (_).
  • Variable names can contain letters, digits, and underscores.
  • Variable names are case-sensitive, which means that x, X, and _x are all different variables.

Please keep in mind that starting a variable name with a capital letter is generally not recommended in Python, as that could make it confusing with class name, which should always start with a capital letter.

It is important to follow the Python naming conventions to make your code more readable and easier to understand for other programmers.

In Python, there are several built-in variable types that serve as the basis for all other types:

Scroll to Top