Skip to content
Python

Math API Reference

Python built-in numeric functions — abs, round, min, max, sum, pow, divmod and conversions.

By EZ4Code Team

Built-in Math Functions

Built-in numeric functions available without import.

abs(x)

Return the absolute value of x.

Returns: int | float

round(number[, ndigits])

Round number to ndigits precision (default 0). Uses banker's rounding.

Returns: int | float

min(iterable, *[, key, default])

Return the smallest item in an iterable or among arguments.

Returns: Any

max(iterable, *[, key, default])

Return the largest item in an iterable or among arguments.

Returns: Any

sum(iterable[, start])

Sum items of iterable, starting from start (default 0).

Returns: number

pow(base, exp[, mod])

Return base**exp. If mod is given, return base**exp % mod (efficient modular exponentiation).

Returns: number

divmod(a, b)

Return (a // b, a % b) as a tuple.

Returns: tuple[number, number]

chr(i)

Return the string representing a character whose Unicode code point is i.

Returns: str

ord(c)

Return the Unicode code point of a single character.

Returns: int

hex(x)

Return the hexadecimal string representation of an integer, prefixed with '0x'.

Returns: str

bin(x)

Return the binary string representation of an integer, prefixed with '0b'.

Returns: str

More Python API References