Identifiers in Python
Python keywords cannot be used as entity names. The name given to a variable, class, or function in Python is called an identifier. But there are some rules for writing identifiers.
Rules for a valid identifier name
- A keyword cannot be used as an identifier.
- An identifier can be in lowercase, uppercase, digits, or the combination of all three. Underscore (_) is also valid.
- An identifier cannot begin with a digit. The first character should be an alphabet (uppercase or lowercase) or an underscore.
- Symbols such as #, $, %, @, etc cannot be used in identifiers
There is no length limit for identifiers in Python.
Example of Valid Identifier in python
Examples of Invalid Identifier in python