conversions.binary_to_hexadecimal

Attributes

BITS_TO_HEX

Functions

bin_to_hexadecimal(→ str)

Converting a binary string into hexadecimal using Grouping Method

Module Contents

conversions.binary_to_hexadecimal.bin_to_hexadecimal(binary_str: str) str

Converting a binary string into hexadecimal using Grouping Method

>>> bin_to_hexadecimal('101011111')
'0x15f'
>>> bin_to_hexadecimal(' 1010   ')
'0x0a'
>>> bin_to_hexadecimal('-11101')
'-0x1d'
>>> bin_to_hexadecimal('a')
Traceback (most recent call last):
    ...
ValueError: Non-binary value was passed to the function
>>> bin_to_hexadecimal('')
Traceback (most recent call last):
    ...
ValueError: Empty string was passed to the function
conversions.binary_to_hexadecimal.BITS_TO_HEX