Here Is A Table Listing All Python Keywords and Their Uses
Here Is A Table Listing All Python Keywords and Their Uses
Keyword Use
False Boolean value representing false
None Represents the absence of a value or a null value
True Boolean value representing true
and Logical AND operator
as Used to create an alias while importing a module
assert Used for debugging; tests if a condition is true
async Used to declare an asynchronous function or method
await Used to pause the execution of an async function until a result is returned
break Exits the current loop
class Used to define a class
continue Skips the rest of the current loop iteration and moves to the next one
def Used to define a function
del Deletes an object or a variable
elif Used for conditional statements; else if condition
else Used for conditional statements; else block
except Used to catch exceptions in try-except blocks
finally Used to define code that will run regardless of whether an exception occurred
for Used for iterating over a sequence (like a list, tuple, or range)
from Used to import specific parts of a module
global Declares a variable as global, outside the function's local scope
if Used for conditional statements
import Used to import modules or specific parts of modules
in Used to check if a value exists in a sequence (list, tuple, etc.)
is Used to test object identity (whether two objects are the same)
lambda Used to create anonymous functions
nonlocal Declares a variable as non-local (used in nested functions)
not Logical NOT operator
or Logical OR operator
pass A placeholder for code; does nothing (often used in empty functions or classes)
raise Used to raise an exception manually
return Used to return a value from a function
try Used to start a block of code to test for exceptions
while Used to start a while loop that continues while a condition is true
with Used to wrap the execution of a block of code in context management (e.g., file handling)
yield Used in a function to return a value and pause the function, creating a generator
Here are the remaining Python keywords that were not included in your list, along with their uses:
Keyword Use
assert Used for debugging; tests if a condition is true
break Exits the current loop
class Used to define a class
continue Skips the rest of the current loop iteration and moves to the next one
Keyword Use
del Deletes an object or a variable
elif Used for conditional statements; else if condition
else Used for conditional statements; else block
except Used to catch exceptions in try-except blocks
finally Used to define code that will run regardless of whether an exception occurred
for Used for iterating over a sequence (like a list, tuple, or range)
from Used to import specific parts of a module
global Declares a variable as global, outside the function's local scope
if Used for conditional statements
import Used to import modules or specific parts of modules
in Used to check if a value exists in a sequence (list, tuple, etc.)
is Used to test object identity (whether two objects are the same)
lambda Used to create anonymous functions
nonlocal Declares a variable as non-local (used in nested functions)
not Logical NOT operator
or Logical OR operator
pass A placeholder for code; does nothing (often used in empty functions or classes)
raise Used to raise an exception manually
return Used to return a value from a function
try Used to start a block of code to test for exceptions
while Used to start a while loop that continues while a condition is true
with Used to wrap the execution of a block of code in context management (e.g., file handling)
yield Used in a function to return a value and pause the function, creating a generator
The remaining Python built-in functions and keywords like len are not keywords, but rather built-in
functions and special functions in Python. Below is a list of some of the commonly used built-in functions
and concepts that are often confused with keywords:
Function Use
abs() Returns the absolute value of a number
all() Returns True if all items in an iterable are true
any() Returns True if any item in an iterable is true
ascii() Returns a string containing a printable representation of an object
bin() Converts an integer to a binary string
bool() Converts a value to a Boolean value (True or False)
bytearray() Returns a new array of bytes
callable() Checks if the object appears callable
chr() Converts an integer to a character (Unicode)
classmethod() Converts a method into a class method
compile() Compiles source into a code object that can be executed
complex() Creates a complex number from real and imaginary parts
delattr() Deletes an attribute of an object
dict() Creates a dictionary from key-value pairs
Function Use
dir() Returns a list of valid attributes for an object
divmod() Returns the quotient and remainder of two numbers
enumerate() Returns an enumerate object (pairs index with value in an iterable)
eval() Executes a string of Python code dynamically
exec() Executes Python code dynamically
filter() Filters elements from an iterable based on a function
float() Converts a value to a floating-point number
format() Returns a formatted string
frozenset() Creates a frozenset (an immutable set)
getattr() Returns the value of a named attribute of an object
globals() Returns the global symbol table (a dictionary)
hasattr() Checks if an object has a specific attribute
hash() Returns the hash value of an object
help() Invokes the built-in help system
hex() Converts an integer to a hexadecimal string
id() Returns the identity of an object
input() Reads a line of text from user input
int() Converts a value to an integer
isinstance() Checks if an object is an instance of a specified class
issubclass() Checks if a class is a subclass of another class
iter() Returns an iterator object from an iterable
len() Returns the length (number of items) of an object
list() Converts an iterable into a list
locals() Returns the local symbol table (a dictionary)
map() Applies a function to all items in an iterable
max() Returns the largest item from an iterable or the largest of two or more arguments
memoryview() Creates a memory view object from a given object
min() Returns the smallest item from an iterable or the smallest of two or more arguments
next() Returns the next item from an iterator
object() Creates a new, generic object
oct() Converts an integer to an octal string
open() Opens a file and returns a file object
ord() Converts a character to its Unicode integer representation
pow() Returns the value of a number raised to a power, optionally modulo another number
print() Prints objects to the standard output
property() Returns a property object, used for managing attributes of a class
range() Returns an iterable for a range of numbers
repr() Returns a string representation of an object
reversed() Returns a reversed iterator of an iterable
round() Rounds a floating point number to the nearest integer or specified precision
set() Creates a set object (an unordered collection of unique elements)
setattr() Sets the value of an attribute of an object
slice() Creates a slice object, used for slicing sequences
sorted() Returns a sorted list from any iterable
Function Use
staticmethod() Converts a method into a static method
str() Converts a value to a string
sum() Sums the items in an iterable
super() Returns a proxy object that delegates method calls to the parent class
tuple() Creates a tuple object (an immutable ordered sequence)
type() Returns the type of an object
vars() Returns the __dict__ attribute of an object
zip()
Returns an iterator of tuples, where the first item in each passed iterator is paired
together, then the second item, and so on
These built-in functions are a core part of Python's functionality, providing a variety of utilities for working
with different types of data structures, handling errors, manipulating files, and more.
Note that these are not keywords, but they are frequently used in Python programming. You can call them
freely in your code, but like keywords, they have specific meanings and functionalities within Python.