maths.abs

Absolute Value.

Functions

abs_max(→ int)

abs_max_sort(→ int)

abs_min(→ int)

abs_val(→ float)

Find the absolute value of a number.

test_abs_val()

Module Contents

maths.abs.abs_max(x: list[int]) int
>>> abs_max([0,5,1,11])
11
>>> abs_max([3,-10,-2])
-10
>>> abs_max([])
Traceback (most recent call last):
    ...
ValueError: abs_max() arg is an empty sequence
maths.abs.abs_max_sort(x: list[int]) int
>>> abs_max_sort([0,5,1,11])
11
>>> abs_max_sort([3,-10,-2])
-10
>>> abs_max_sort([])
Traceback (most recent call last):
    ...
ValueError: abs_max_sort() arg is an empty sequence
maths.abs.abs_min(x: list[int]) int
>>> abs_min([0,5,1,11])
0
>>> abs_min([3,-10,-2])
-2
>>> abs_min([])
Traceback (most recent call last):
    ...
ValueError: abs_min() arg is an empty sequence
maths.abs.abs_val(num: float) float

Find the absolute value of a number.

>>> abs_val(-5.1)
5.1
>>> abs_val(-5) == abs_val(5)
True
>>> abs_val(0)
0
maths.abs.test_abs_val()
>>> test_abs_val()