Python Math Snippets
The Python snippet collection contains helper functions for Python 3.6. It includes utilities for most common data types, such as primitivies, lists, dictionaries and date objects.
Converts a hexadecimal color code to a tuple of integers corresponding to its RGB components.
Finds the items that are parity outliers in a given list.
Converts the values of RGB components to a hexadecimal color code.
Returns the sum of the powers of all the numbers from
start
toend
(both inclusive).Converts an integer to its roman numeral representation. Accepts value between
1
and3999
(both inclusive).Calculates the average of a list, after mapping each element to a value using the provided function.
Converts a number to a list of digits.
Initializes a list containing the numbers in the specified range where
start
andend
are inclusive and the ratio between two terms isstep
. Returns an error ifstep
equals1
.Returns the maximum value of a list, after mapping each element to a value using the provided function.
Returns the minimum value of a list, after mapping each element to a value using the provided function.
Calculates the sum of a list, after mapping each element to a value using the provided function.
Finds the median of a list of numbers.
Reverses a number.
Calculates the Hamming distance between two values.
Returns the least common multiple of a list of numbers.