Python - Built-in Functions



Built-in Functions

In Python, there are several functions that are pre-defined in the Python interpreter, hence we don't need to import them from any module before using them. These functions help in performing a wide variety of operations on strings, iterators and numbers.

As of Python 3.12.2 version, the list of built-in functions is given below −

Sr.No. Function & Description

1

Python aiter() function

Returns an asynchronous iterator for an asynchronous iterable

2

Python all() function

Returns true when all elements in iterable is true

3

Python anext() function

Returns the next item from the given asynchronous iterator

4

Python any() function

Checks if any Element of an Iterable is True

5

Python ascii() function

Returns String Containing Printable Representation

6

Python bin() function

Converts integer to binary string

7

Python bool() function

Converts a Value to Boolean

8

Python breakpoint() function

This function drops you into the debugger at the call site and calls sys.breakpointhook()

9

Python bytearray() function

returns array of given byte size

10

Python bytes() function

returns immutable bytes object

11

Python callable() function

Checks if the Object is Callable

12

Python chr() function

Returns a Character (a string) from an Integer

13

Python classmethod() function

Returns class method for given function

14

Python compile() function

Returns a code object

15

Python complex() function

Creates a Complex Number

16

Python delattr() function

Deletes Attribute From the Object

17

Python dict() function

Creates a Dictionary

18

Python dir() function

Tries to Return Attributes of Object

19

Python divmod() function

Returns a Tuple of Quotient and Remainder

20

Python enumerate() function

Returns an Enumerate Object

21

Python eval() function

Runs Code Within Program

22

Python exec() function

Executes Dynamically Created Program

23

Python filter() function

Constructs iterator from elements which are true

24

Python float() function

Returns floating point number from number, string

25

Python format() function

Returns formatted representation of a value

26

Python frozenset() function

Returns immutable frozenset object

27

Python getattr() function

Returns value of named attribute of an object

28

Python globals() function

Returns dictionary of current global symbol table

29

Python hasattr() function

Returns whether object has named attribute

30

Python hash() function

Returns hash value of an object

31

Python help() function

Invokes the built-in Help System

32

Python hex() function

Converts to Integer to Hexadecimal

33

Python id() function

Returns Identify of an Object

34

Python input() function

Reads and returns a line of string

35

Python int() function

Returns integer from a number or string

36

Python isinstance() function

Checks if a Object is an Instance of Class

37

Python issubclass() function

Checks if a Class is Subclass of another Class

38

Python iter() function

Returns an iterator

39

Python len() function

Returns Length of an Object

40

Python list() function

Creates a list in Python

41

Python locals() function

Returns dictionary of a current local symbol table

42

Python map() function

Applies Function and Returns a List

43

Python memoryview() function

Returns memory view of an argument

44

Python next() function

Retrieves next item from the iterator

45

Python object() function

Creates a featureless object

46

Python oct() function

Returns the octal representation of an integer

47

Python open() function

Returns a file object

48

Python ord() function

Returns an integer of the Unicode character

49

Python print() function

Prints the Given Object

50

Python property() function

Returns the property attribute

51

Python range() function

Returns a sequence of integers

52

Python repr() function

Returns a printable representation of the object

53

Python reversed() function

Returns the reversed iterator of a sequence

54

Python set() function

Constructs and returns a set

55

Python setattr() function

Sets the value of an attribute of an object

56

Python slice() function

Returns a slice object

57

Python sorted() function

Returns a sorted list from the given iterable

58

Python staticmethod() function

Transforms a method into a static method

59

Python str() function

Returns the string version of the object

60

Python super() function

Returns a proxy object of the base class

61

Python tuple() function

Returns a tuple

62

Python type() function

Returns the type of the object

63

Python vars() function

Returns the __dict__ attribute

64

Python zip() function

Returns an iterator of tuples

65

Python __import__() function

Function called by the import statement

Built-in Mathematical Functions

There are some additional built-in functions that are used for performing only mathematical operations in Python, they are listed below −

Sr.No. Function & Description

1

Python abs() function

The abs() function returns the absolute value of x, i.e. the positive distance between x and zero.

2

Python max() function

The max() function returns the largest of its arguments or largest number from the iterable (list or tuple).

3

Python min() function

The function min() returns the smallest of its arguments i.e. the value closest to negative infinity, or smallest number from the iterable (list or tuple)

4

Python pow() function

The pow() function returns x raised to y. It is equivalent to x**y. The function has third optional argument mod. If given, it returns (x**y) % mod value

5

Python round() Function

round() is a built-in function in Python. It returns x rounded to n digits from the decimal point.

6

Python sum() function

The sum() function returns the sum of all numeric items in any iterable (list or tuple). An optional start argument is 0 by default. If given, the numbers in the list are added to start value.

Advertisements