Keywords and Identifier in Python
Keyword/Reserved Words in Python:
In Python, we cannot use a Reserved word as a variable name, function name or any other identifier. They are used to define the syntax and structure of the Python language.
In Python, Reserved words are case-sensitive. There are 35 keywords in Python 3 to the date of post. All the keywords except True, False, and None are in lowercase and must be written in lowercase
There are following Reserved words in Python:

To directly checklist of reserved word/keyword go to python interpreter and type the following code :
>>>import keyword
>>>print(keyword.kwlist)
This code will print all keyword/reserved words of python.
Identifier:

An identifier in python used to identify a variable function, class, module, or any other objects. Python is case sensitive so uppercase and lowercase letter are considered distinct(different).
Following Rules are used for naming an identifier in python:
- Python Identifier can be a combination of letters in lowercase(a-z) uppercase(A-Z) or digits(0-9) or an underscore ( _ ). Eg- Ram, and ram is treated differently in python because it is case sensitive programming language
- Reserved keywords cannot be used as identifiers.
- Identifiers cannot begin with a digit(0-9). Eg- 0atom, 9Hero, 2times, 2person, etc.
- Special Symbols ( @, !, #,$, %etc ) cannot be used in identifier Eg- #raj , monty@ , b@nty, etc is invalid identifiers
- An identifier can be of any Length
Naming Convention in Python:
- Class names start with an uppercase letter and all other identifiers start with a lowercase Eg- People, Person, etc
- Identifier name start with a single leading underscore ( _.. ) indicates that the identifier is Private Eg- sum, _name, _ram, etc.
- Identifier name starts with Double leading underscore ( __.. ) indicates that the identifier is Strongly Private Eg- sum, __name, __ram, etc.
- Identifier name Ending with Double trailing underscore ( ..__ ) indicates that the identifier is a Language-defined special name Eg- sum, name, ram__, foo__, etc
Keywords and Identifier in Python
View Our Article On Python
- Keywords and Identifier in Python
- Introduction to Python and Its Applications For Data Science?
- Introduction To Python Programming?
- How To run Python in Windows/Mac/Linux?
View Our Latest Article
- Data For You –data4u.tech
- DigitPro – digitpro.tech
[…] Keywords and Identifier in Python? […]