conversions.binary_to_decimal ============================= .. py:module:: conversions.binary_to_decimal Functions --------- .. autoapisummary:: conversions.binary_to_decimal.bin_to_decimal Module Contents --------------- .. py:function:: bin_to_decimal(bin_string: str) -> int Convert a binary value to its decimal equivalent >>> bin_to_decimal("101") 5 >>> bin_to_decimal(" 1010 ") 10 >>> bin_to_decimal("-11101") -29 >>> bin_to_decimal("0") 0 >>> bin_to_decimal("a") Traceback (most recent call last): ... ValueError: Non-binary value was passed to the function >>> bin_to_decimal("") Traceback (most recent call last): ... ValueError: Empty string was passed to the function >>> bin_to_decimal("39") Traceback (most recent call last): ... ValueError: Non-binary value was passed to the function