Python Keywords

Python keywords are reserved words that have a predefined meaning in the language. These keywords cannot be used as variable names, function names, or any other identifiers. They form the core syntax of Python and are essential for writing Python programs.

List of Python Keywords

KeywordDescription
FalseRepresents the boolean value false.
NoneRepresents a null value or absence of a value.
TrueRepresents the boolean value true.
andLogical AND operator. Returns True if both conditions are True.
asUsed to create an alias when importing a module.
assertUsed for debugging; tests if a condition is true.
asyncDefines an asynchronous function (introduced in Python 3.5).
awaitPauses execution of an async function until the awaited task is complete.
breakExits the loop prematurely.
classDefines a new class.
continueSkips the current iteration of a loop and moves to the next iteration.
defDefines a function.
delDeletes an object or variable.
elifElse-if condition in conditional statements.
elseSpecifies a block of code to run if conditions are false.
exceptHandles exceptions in a try-except block.
finallyA block of code that always executes, even if an exception occurs.
forUsed for looping over a sequence.
fromUsed for importing specific parts of a module.
globalDeclares a global variable inside a function.
ifStarts a conditional statement.
importImports a module into the script.
inChecks if a value exists within a sequence.
isChecks if two variables reference the same object.
lambdaDefines an anonymous function.
nonlocalDeclares a non-local variable in a nested function.
notLogical NOT operator. Returns the opposite boolean value.
orLogical OR operator. Returns True if at least one condition is True.
passA placeholder statement that does nothing.
raiseRaises an exception.
returnReturns a value from a function.
tryBegins a block for exception handling.
whileStarts a loop that runs as long as a condition is true.
withSimplifies exception handling in context management.
yieldPauses and resumes a function, producing a generator.