pysnippets.numbers
Conversions, ranges and number checks.
- clamp_number(value, low, high)Limit a value to an inclusive range, accepting the bounds in either order.
- digitize(n)Turn an integer into a list of its decimal digits.
- is_prime(n)Test primality by trial division up to the integer square root.
- num_to_range(value, in_min, in_max, out_min, out_max)Linearly map a value from one range onto another, like Arduino's map().
- to_roman_numeral(number)Convert 1 to 3999 into Roman numerals with a greedy table, rejecting values outside that range.