Python Keywords

KeywordDescription
FalseA boolean value representing “false.”
NoneA special object representing the absence of a value.
TrueA boolean value representing “true.”
andA logical operator for “and” condition.
asUsed for aliasing a module or class name.
assertA debugging aid that tests a condition as true or false.
asyncUsed to define asynchronous functions and methods.
awaitUsed to pause and wait for the result of an async call.
breakExits the nearest enclosing loop.
classDefines a class, a blueprint for creating objects.
continueSkips the rest of the current iteration of a loop.
defDefines a function or method.
delDeletes a reference to an object.
elifUsed in conditional statements, similar to “else if.”
elseSpecifies a block of code to be executed if a condition is false.
exceptCatches and handles exceptions.
finallySpecifies a block of code to be executed regardless of whether an exception is raised or not.
forUsed for looping through iterable objects.
fromUsed to import specific parts of a module.
globalDeclares a global variable.
ifConditional statement that executes code if a condition is true.
importUsed to import modules or libraries.
inChecks if a value is present in an iterable.
isTests if two variables reference the same object.
lambdaCreates small anonymous functions.
nonlocalDeclares a non-local variable.
notA logical operator for negation.
orA logical operator for “or” condition.
passPlaceholder statement, does nothing.
raiseRaises an exception.
returnExits a function and returns a value.
tryExecutes a block of code and catches exceptions.
whileCreates a loop that executes a block of code as long as a condition is true.
withUsed for resource management (e.g., file handling).
yieldPauses a function and saves its state for later.