Python Identifiers
Python Identifiers
In this tutorial, we will learn about Python identifiers. Identifiers are the names given to entities like variables, classes, functions, modules, etc. It helps differentiate one entity from another. Python is a case-sensitive language.
Python Identifier Rules
Python language defines certain rules while declaring an identifier. Some of the basic rules for defining identifiers are as follows:
- The identifier can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore(……)
- An identifier can not start with a digit. For example, 1_studentNo is an invalid identifier.
- No reserved words. Python keywords can not be used as identifiers.
- No special characters are allowed in the names. Special symbols such as $, &,#,%, etc. can not be used as identifiers.
- Identifiers are case-sensitive. This means that Number and NUMBER are different identifiers in Python.
Programmers should adhere to these rules and conventions. It is crucial for writing clean, readable, and maintainable code. They also help prevent certain types of errors and misunderstandings that can arise from incorrectly named entities.
—
Python Tutorials
Python Tutorial on this website can be found at:
https://www.testingdocs.com/python-tutorials/
More information on Python is available at the official website: