Python Keywords

Python has a set of keywords that are reserved words that cannot be used as variable names, function names, or any other identifiers:

Keyword Description
A logical operator
To create an alias
For debugging
To break out of a loop
To define a class
To continue to the next iteration of a loop
To define a function
To delete an object
Used in conditional statements, same as else if
Used in conditional statements
Used with exceptions, what to do when an exception occurs
Boolean value, result of comparison operations
Used with exceptions, a block of code that will be executed no matter if there is an exception or not
To create a for loop
To import specific parts of a module
To declare a global variable
To make a conditional statement
To import a module
To check if a value is present in a list, tuple, etc.
To test if two variables are equal
To create an anonymous function
Represents a null value
To declare a non-local variable
A logical operator
A logical operator
A null statement, a statement that will do nothing
To raise an exception
To exit a function and return a value
Boolean value, result of comparison operations
To make a try...except statement
To create a while loop
with Used to simplify exception handling
yield To end a function, returns a generator