Python Keywords & Their Functions
False: Boolean value representing falsehood.
True: Boolean value representing truth.
None: Represents the absence of a value or null.
and: Logical AND operator.
or: Logical OR operator.
not: Logical NOT operator (negation).
if: Used for conditional execution.
elif: Else if - another condition in an if chain.
else: Defines a block to run if the condition is false.
while: Repeats a block of code while a condition is true.
for: Loops over a sequence (like a list or string).
break: Exits the current loop early.
continue: Skips the rest of the loop body and continues with the next iteration.
in: Checks membership (used in loops and conditions).
is: Tests if two variables point to the same object.
def: Defines a function.
return: Exits a function and optionally returns a value.
lambda: Defines a small anonymous function (used for quick one-liners).
pass: Does nothing (used as a placeholder).
import: Imports a module.
from: Imports specific parts from a module.
as: Gives an alias to an imported module or variable.
class: Defines a class (used in Object-Oriented Programming).
try: Starts a block that will be tested for errors.
except: Catches and handles an error from a try block.
finally: Runs code after try/except, no matter what.
raise: Triggers a specified exception.
global: Declares a variable as global (outside function scope).
nonlocal: Declares a variable from the nearest outer scope (used inside nested
functions).
del: Deletes an object, variable, or item from a list/dictionary.
assert: Used for debugging; throws an error if a condition is false.
yield: Returns a generator object (used to pause/resume functions).
with: Wraps the execution of a block (commonly used with files).
await: Waits for a result in asynchronous code.
async: Declares an asynchronous function.