All Keywords in Python language.
as
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
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
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
class is used to define a new user-defined class in Python
def
def is used to define a user-defined function
del
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
finally is used with block to close up resources or file streams
global
global is used to declare that a variable ‘inside the function is global
in
in is used to test if a sequence (list, tuple, string, etc.)
contains a value
is
is used in Python for testing object identity
pass
pass is a null statement in Python. Nothing happens when it is executed. It is used as a placeholder
return
return statement is used inside a function to exit it and return a value
while
while is used for looping in Python
for
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
with statement is used to wrap the execution of a block of code within methods defined by the context manager
yield
yield is used inside a function like a return statement. But yield returns a generator