In this tutorial you will learn about the Python Keywords & Identifiers and its application with practical example.
Python Identifier
An identifiers is a name given to program elements such as variables , array, class and functions etc. An identifier is a sequence of letters, digits, and underscores, the first character of which can not be a digit. Following rules must be kept in mind while naming an identifier.
- The first character must be an alphabet (uppercase or lowercase) or can be an underscore.
- An identifier can not start with a digit.
- All succeeding characters must be alphabets or digits.
- No special characters like !, @, #, $, % or punctuation symbols is allowed except the underscore”_”.
- No two successive underscores are allowed.
- Keywords can not be used as identifiers.
Note :- Python is a case-sensitive programming language, which means “Abc” and “abc” are not the same.
Python Keywords
Python keywords are set words that cannot be used as an identifier in program. These words are known as “Reserved Words” or “Keywords”. Python Keywords are standard identifiers and their meaning and purpose is predefined by the compiler.
Below is list of available keywords in Python programming Language.
and | assert | in |
del | else | raise |
from | if | continue |
not | pass | finally |
while | yield | is |
as | break | return |
elif | except | def |
global | import | for |
or | lambda | |
with | class | try |
exec |
Note :-We cannot use keywords for declaring Variable Name,For Function Name and for declaring Constant Variable