Keywords in Python Programming


Keywords are the words that convey a special meaning to the language compiler/interpreter. These are reserved for special purpose and must not be used as normal identifier names. Eg: for,break,continue,etc.

  • A keyword is a word having special meaning reserved by programming language
  • We cannot use a keyword as a variable name, function name or any other identifier.
  • True and False are truth values in Python. They are the results of comparison operations or logical (Boolean) operations in Python.
  • None is a special constant in Python that represents the absence of a value or a null value.
  • and, or, not are the logical operators in Python. and will result into True only if both the operands are True.
  • The async and await keywords are provided by the asyncio library in Python. They are used to write concurrent code in Python.

Source Code

import keyword
print(keyword.kwlist)

Output

['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']


Learn All in Tamil © Designed & Developed By Tutor Joes