conversions.hexadecimal_to_decimal

Attributes

hex_table

Functions

hex_to_decimal(→ int)

Convert a hexadecimal value to its decimal equivalent

Module Contents

conversions.hexadecimal_to_decimal.hex_to_decimal(hex_string: str) int

Convert a hexadecimal value to its decimal equivalent #https://www.programiz.com/python-programming/methods/built-in/hex

>>> hex_to_decimal("a")
10
>>> hex_to_decimal("12f")
303
>>> hex_to_decimal("   12f   ")
303
>>> hex_to_decimal("FfFf")
65535
>>> hex_to_decimal("-Ff")
-255
>>> hex_to_decimal("F-f")
Traceback (most recent call last):
    ...
ValueError: Non-hexadecimal value was passed to the function
>>> hex_to_decimal("")
Traceback (most recent call last):
    ...
ValueError: Empty string was passed to the function
>>> hex_to_decimal("12m")
Traceback (most recent call last):
    ...
ValueError: Non-hexadecimal value was passed to the function
conversions.hexadecimal_to_decimal.hex_table