Skip to content

Python Keywords | Infographic

  • by

All Keywords in Python language.


as is used to create an alias while importing a module. It means giving a different name (user-defined) to a module while importing it.


assert is used for debugging purposes

break and continue

break and continue are used inside for and while loops to alter their normal behavior

True and False

True and False are truth values in Python. They are the results of comparison operations or logical (Boolean) operations in Python.


None is a special constant in Python that represents the absence of a value or a null value

and, or, not

and, or, not are the logical operators in Python


class is used to define a new user-defined class in Python


def is used to define a user-defined function


del is used to delete the reference to an object

if, else, elif

if, else, elif are used for conditional branching or decision making

except, raise, try

except, raise, and try are used with exceptions in Python


finally is used with block to close up resources or file streams


global is used to declare that a variable ‘inside the function is global


in is used to test if a sequence (list, tuple, string, etc.)
contains a value


is used in Python for testing object identity


pass is a null statement in Python. Nothing happens when it is executed. It is used as a placeholder


return statement is used inside a function to exit it and return a value


while is used for looping in Python


for is used for looping. Generally, we use for when we know the number of times we want to loop.

from and import

import keyword is used to import modules into the current namespace. is used to import specific attributes or functions into the current namespace


with statement is used to wrap the execution of a block of code within methods defined by the context manager


yield is used inside a function like a return statement. But yield returns a generator

Leave a Reply

Your email address will not be published. Required fields are marked *