Start of main content## 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.

### Hex to RGB

Python, String

Converts a hexadecimal color code to a tuple of integers corresponding to its RGB components.

### Digitize number

Python, Math

Converts a number to a list of digits.

### Find parity outliers

Python, List

Finds the items that are parity outliers in a given list.

### RGB to hex

Python, String

Converts the values of RGB components to a hexadecimal color code.

### Sum of powers

Python, Math

Returns the sum of the powers of all the numbers from

`start`

to`end`

(both inclusive).### Integer to roman numeral

Python, Math

Converts an integer to its roman numeral representation. Accepts value between

`1`

and`3999`

(both inclusive).### Mapped list average

Python, Math

Calculates the average of a list, after mapping each element to a value using the provided function.

### Max list value based on function

Python, Math

Returns the maximum value of a list, after mapping each element to a value using the provided function.

### Median

Python, Math

Finds the median of a list of numbers.

### Min list value based on function

Python, Math

Returns the minimum value of a list, after mapping each element to a value using the provided function.

### Sum list based on function

Python, Math

Calculates the sum of a list, after mapping each element to a value using the provided function.

### Geometric progression

Python, Math

Initializes a list containing the numbers in the specified range where

`start`

and`end`

are inclusive and the ratio between two terms is`step`

.### N max elements

Python, List

Returns the

`n`

maximum elements from the provided list.### N min elements

Python, List

Returns the

`n`

minimum elements from the provided list.### Reverse number

Python, Math

Reverses a number.