Standard Python Functions

Posted by

Python has a large number of built-in/standard functions that perform a variety of tasks, such as calculating the square root of a number or finding the length of a list.

Here are a few examples of standard Python functions:

  • abs() : Returns the absolute value of a number
  • all() : Returns True if all elements of an iterable are True , and False otherwise
  • any() : Returns True if any element of an iterable is True , and False otherwise
  • bin() : Converts an integer to a binary string
  • bool() : Converts a value to a Boolean ( True or False )
  • chr() : Returns the character corresponding to an ASCII code
  • dir() : Returns a list of attributes and methods of an object
  • enumerate() : Returns an enumerate object that contains pairs (index, element) for each element in a list
  • filter() : Filters elements from an iterable based on a function
  • float() : Converts a value to a floating-point number
  • format() : Formats a string
  • hex() : Converts an integer to a hexadecimal string
  • int() : Converts a value to an integer
  • len() : Returns the length of an object
  • max() : Returns the largest element of an iterable
  • min() : Returns the smallest element of an iterable
  • oct() : Converts an integer to an octal string
  • ord() : Returns the ASCII code of a character
  • pow() : Returns the result of raising a number to a power
  • repr() : Returns a string representation of an object
  • sorted() : Returns a sorted list from an iterable
  • sum() : Returns the sum of the elements of an iterable
  • type() : Returns the type of an object
  • divmod() : returns the quotient and remainder of a division operation
  • hex() : returns the hexadecimal representation of an integer
  • oct() : returns the octal representation of an integer
  • pow() : returns the result of raising a number to a specified power
  • round() : returns a number rounded to a specified number of decimal places
  • format() : formats a specified value
  • repr() : returns a printable representation of an object
  • tuple() : returns a tuple object constructed from an iterable
  • set() : returns a set object constructed from an iterable
  • frozenset() : returns a frozen set object constructed from an iterable
  • dict() : returns a dictionary object constructed from an iterable
  • chr() : returns a character for a specified Unicode code point
  • ord() : returns the Unicode code point for a specified character
  • isinstance() : returns True if an object is an instance of a specified class or type
  • issubclass() : returns True if a class is a subclass of a specified class

This is just a small selection of the built-in functions that Python provides.

You can find a full list of built-in functions in the Python documentation: https://docs.python.org/3/library/functions.html

Leave a Reply

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