Python: useful built-in Functions
Saad Bash
Commonly used built-in Python Functions
| Calling Syntax | Description |
|---|---|
abs(x) |
Return the absolute value of a number. |
chr(integer) |
Return a one-character string with the given Unicode code point. |
divmod(x, y) |
Return (x // y, x % y) as tuple, if x and y are integers. |
len(iterable) |
Return the number of elements in the given iteration. |
max(iterable) |
Return the largest element of the given iteration. |
min(iterable) |
Return the smallest element of the given iteration. |
ord(chr) |
Return the Unicode code point of the given character. |
range(stop) |
Construct an iteration of values 0, 1, ..., stop - 1. |
range(start, stop) |
Contruct an iteration of values start, start + 1, ..., stop - 1. |
range(start, stop, step) |
Construct an iteration of values start, start + step, ... |
reversed(sequence) |
Return an iteration of the sequence in reverse. |
sorted(iterable) |
Return a list containing elements of the iterable in sorted order. |
sum(iterable) |
Return the sum of the elements in the eterable (must be numeric). |