Keywords
| and | A logical operator used to combine two expressions and return a truthy value if both expressions are true. |
| as | Creates an alias or alternative name for a module, exception, or context manager. |
| assert | Lets you create an assertion or sanity check to test whether a given condition is true. |
| async | Lets you define asynchronous functions, loops, context managers, generators, and iterators, which perform non-blocking operations. |
| await | Pauses the execution of a coroutine until the result is available, allowing other tasks to run concurrently. |
| break | Exits a loop immediately, and Python continues executing the code that follows the loop. |
| case | A soft keyword that's used in conjunction with the match statement to perform pattern matching. |
| class | Lets you create user-defined classes, which are the cornerstone of object-oriented programming (OOP). |
| continue | Lets you skip the rest of the code inside a loop for the current iteration and jump to the next iteration. |
| def | Defines a function, which is a reusable block of code that can accept data input, perform a specific computation or task, and return a result or produce a side effect. |
| del | Deletes names from a given scope or namespace. |
| elif | Defines a branch in a conditional statement to check alternative expressions for truth value. |
| else | Specifies a block of code to be executed when a certain condition is false in control flow statements such as if, while, and for. |
| except | Catches and handles exceptions that occur during the execution of a program. |
| false | A built-in constant that represents the Boolean value for false. |
| finally | Is used in a try statement to define a block of code that will always execute, regardless of whether an exception was raised. |
| for | Creates a loop that iterates over an iteratble, such as a list, tuple, string, or range. It also defines comprehensions and generator expressions. |
| from | Is primarily used to import specific objects from a module into your current namespace. |
| global | Lets you declare that a variable used inside a function is global, which allows you to modify the variable defined outside of the current function scope. |
| if | Starts a conditional statement that allows you to execute a code block only if a specified condition is true. |
| import | Allows you to include modules in your program and use their functionalities directly in your code. |
| in | Used for membership tests, for loops, comprehensions, and generator expressions. |
| is | An operator that lets you test for object identity by checking whether two variables point to the same object in memory. |
| lambda | Creates anonymous functions, also known as lambda functions, which can take any number of arguments and whose body must be a single expression. |
| match | A soft keyword that's used to perform structural pattern matching. |
| None | A built-in constant that represents the absence of a value or a null value. |
| nonlocal | Lets you declare a variable in a nested function as not local to that function. |
| not | A logical operator that inverts the truth value of the expression returning True or False. |
| or | A logical operator that evaluates two expressions and returns True if at least one of the expressions is true. |
| pass | A placeholder statement that allows you to write syntactically correct code without executing any operations. |
| raise | Allows you to trigger exceptions manually when a particular error arises in your code. |
| return | Exits a function and returns a value back to the caller. |
| true | A built-in constant that represents the Boolean value for true. |
| try | Defines a block of code you want to run, along with a way to manage exceptions that might occur during its execution. |
| type | A soft keyword used to explicitly define generic type aliases in the context of type hints or type annotations. |
| underscore (_) | A soft keyword that acts as a wildcard, useful when you want to handle all unmatched cases in a match statement. |
| while | Defines a loop that executes a block of code as long as a specified condition remains true. |
| with | Wraps the execution of a block of code within methods defined by a context manager. |
| yield | The yield keyword turns a function into a generator, returning an iterator that produces values on demand instead of computing them all at once. |
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrev