Python Identifiers
In Python, identifiers are the building blocks of a program. Identifiers are unique names that are assigned to variables, functions, classes, and other entities. They are used to uniquely identify the entity within the program. They should start with a letter (a-z, A-Z) or an underscore “_” and can be followed by letters, numbers, or underscores. In the below example “first_name” is an identifier that store string value.
first_name = "Ram"
For naming of an identifier we have to follows some rules given below:
- Identifiers can be composed of alphabets (either uppercase or lowercase), numbers (0-9), and the underscore character (_). They shouldn’t include any special characters or spaces.
- The starting character of an identifier must be an alphabet or an underscore.
- Certain words in Python, known as reserved Identifier, have specific functions and meanings. As such, these words can’t be chosen as identifiers. For instance, the term “print” already serves a specific purpose in Python and can’t be used as an identifier.
- Within its specific scope or namespace, each identifier should have a distinct name.
Python Syntax
Python is known for its clean and readable syntax, which makes it an excellent language for beginners, but also powerful enough for advanced applications. In this article, we will learn about the basic elements of Python syntax.
Prerequisites: Before diving into Python syntax, ensure you have: