Identifiers & Keywords
Comments are used to make programming more readable ,comments are generally ignored by the interpreter.
- Hash # is used for the single line comment
- Multiple comments start with “ and ends with the ”.
We can directly use the python shell for quick programming or for the testing purpose,and we can also use a Python notebook for the long extensive code.
Python 3.8.4 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)] on win32 >>> 33+3 36 >>> 33-3 31
- Reserve words are called Keywords in Python,which have some of their unique features in Python languages,Python supports 33 Keywords.
- Keywords are case sensitive.
- Except of True and False ,all keyword are in lower cases
- We can use keywords as Identifiers.
To get the list of all Python keywords, use below command
Python 3.8.4 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)] on win32 >>> import keyword >>> print(keyword.kwlist) ['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
In above command,
- Above command is used for the show the Python Keyword.
- Python Identifiers are user-defined names to represent a variable, function, class, module or any other object,and help in differentiating one entity from another.
Python Identifier writing rules
- Identifier must be in alphanumeric. Eg . abc,avc123
- Special Symbol not allowed except underscore(_)
- Identifier is not a reserved word.
- White space is not allowed.