week1/06-binary-converter/binary-converter.py
2023-09-20 09:53:04 -04:00

17 lines
656 B
Python

def binary_to_decimal(num):
pass
def decimal_to_binary(num):
pass
assert binary_to_decimal(0) == 0, "0 to decimal should return 0"
assert binary_to_decimal(1011) == 11, "1011 to decimal should return 11"
assert binary_to_decimal(101011) == 43, "101011 to decimal should return 43"
assert binary_to_decimal(101011101) == 349, "101011101 to decimal should return 349"
assert decimal_to_binary(0) == 0, "0 to binary should return 0"
assert decimal_to_binary(5) == 101, "5 to binary should return 101"
assert decimal_to_binary(10) == 1010, "10 to binary should return 1010"
assert decimal_to_binary(113) == 1110001, "113 to binary should return 1110001"