> For the complete documentation index, see [llms.txt](https://ret2basic.gitbook.io/ctfnote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ret2basic.gitbook.io/ctfnote/computer-science/python/built-in-functions-and-standard-library.md).

# Built-in Functions and Standard Library

## Built-in Functions

* abs(x)
* all(s)
* any(s)
* ascii(x)
* bin(x)
* bool(\[x])
* breakpoint()
* bytearray(\[x])
* bytearray(s, encoding)
* bytes(\[x])
* bytes(s, encoding)
* callable(obj)
* chr(x)
* classmethod(func)
* compile(string, filename, kind)
* complex(\[real \[, imag]])
* delattr(object, attr)
* dict(\[m]) or dict(key1=value1, key2=value2, ...)
* dir(\[object])
* divmod(a, b)
* enumerate(iter, start=0)
* eval(expr, \[, globals \[, locals]])
* exec(code \[, globals \[, locals]])
* filter(function, iterable)
* float(\[x])
* format(value \[, format\_spec])
* `frozenset([iterms])`
  * Type representing an immutable set object populated with values taken from `items` which must be an iterable. The values must also be immutable. If no argument is given, an empty set is returned. A `frozenset` supports all of the operations found on `sets` except for any operations that mutate a set in-place.
* getattr(object, name \[, default])
* globals()
* hasattr(object, name)
* hash(object)
* hex(x)
* id(object)
* input(\[prompt])
* int(x \[, base])
* isinstance(object, classobj)
* issubclass(class1, class2)
* iter(object, \[, sentinel])
* len(s)
* list(\[items])
* locals()
* map(function, items, ...)
* max(s \[, args, ...], \*, default=obj, key=func)
* min(s \[, args, ...], \*, default=obj, key=func)
* next(s \[, default])
* object()
* oct(x)
* open(filename \[, mode \[, bufsize \[, encoding \[, errors \[, newline \[, closefd]]]]]])
* ord(c)
* pow(x, y \[, z])
* print(value, ..., \*, sep=separator, end=ending, file=outfile)
* property(\[fget \[, fset \[, fdel \[, doc]]]])
* range(\[start,] stop \[,step])
* repr(object)
* reversed(s)
* round(x \[, n])
* set(\[items])
* setattr(object, name, value)
* slice(\[start,] stop \[, step])
* sorted(iterable, \*, key=keyfunc, reverse=reverseflag)
* staticmethod(func)
* str(\[object])
* sum(items \[, initial])
* super()
* tuple(\[items])
* type(object)
* vars(\[object])
* zip(\[s1 \[, s2 \[, ...]]])

## Built-in Exceptions

### Exception Base Classes

* `BaseException`
  * The root class for all exceptions. All built-in exceptions are derived from this class.
* `Exception`
  * The base class for all program-related exceptions. That includes all built-in exceptions except for SystemExit, GeneratorExit, and KeyboardInterrupt. User-defined exceptions should inherit from Exception.
* `ArithmeticError`
  * The base class for arithmetic exceptions, including `OverflowError`, `ZeroDivisionError`, and `FloatingPointError`.
* `LookupError`
  * The base class for indexing and key errors, including `IndexError` and `KeyError`.
* `EnvironmentError`
  * The base class for errors that occur outside Python. Is a synonym for `OSError`.

For example:

```python
try:
    x = 1 / 0
except ArithmeticError as e:
    print('Math is wrong.')
```

### Exception Attributes

### Predefined Exception Classes

## Standard Library
