Keywords are reserved words that cannot be used as variable names. The following table gives the list of keywords and their purpose:
Keywords |
Explanation |
False |
Boolean false value: >>bool_var = False |
True |
Boolean true value: >>bool_var = True |
and |
Logical operator that returns True only if both the operands are True or evaluates to True: >>a = 2 >>if a > 0: print(a) >>2 |
as |
Creates an alias for a module that is being imported: import pandas as pd import scikit-learn as skl |
assert |
Used to evaluate a logical expression to check values of variables at runtime and raises an AssertionError if the expression evaluates to False: >>a = -2 >> assert a > 0 The preceding assert keyword raises ... |