bit_manipulation.binary_or_operator¶
Functions¶
|
Take in 2 integers, convert them to binary, and return a binary number that is the |
Module Contents¶
- bit_manipulation.binary_or_operator.binary_or(a: int, b: int) str ¶
Take in 2 integers, convert them to binary, and return a binary number that is the result of a binary or operation on the integers provided.
>>> binary_or(25, 32) '0b111001' >>> binary_or(37, 50) '0b110111' >>> binary_or(21, 30) '0b11111' >>> binary_or(58, 73) '0b1111011' >>> binary_or(0, 255) '0b11111111' >>> binary_or(0, 256) '0b100000000' >>> binary_or(0, -1) Traceback (most recent call last): ... ValueError: the value of both inputs must be positive >>> binary_or(0, 1.1) Traceback (most recent call last): ... TypeError: 'float' object cannot be interpreted as an integer >>> binary_or("0", "1") Traceback (most recent call last): ... TypeError: '<' not supported between instances of 'str' and 'int'