return the bit string of an integer getreversebitstring9 10010000000000000000000000000000 getreversebitstring43 11010100000000000000000000000000 getreversebitstring2873 10011100110100000000000000000000 getreversebitstringthis is not a number traceback most recent call last typeerror operation can not be conducted on a object of type str take in an 32 bit integer reverse its bits return a string of reverse bits result of a reversebit and operation on the integer provided reversebit25 00000000000000000000000000011001 reversebit37 00000000000000000000000000100101 reversebit21 00000000000000000000000000010101 reversebit58 00000000000000000000000000111010 reversebit0 00000000000000000000000000000000 reversebit256 00000000000000000000000100000000 reversebit1 traceback most recent call last valueerror the value of input must be positive reversebit1 1 traceback most recent call last typeerror input value must be a int type reversebit0 traceback most recent call last typeerror not supported between instances of str and int iterator over 1 to 32 since we are dealing with 32 bit integer left shift the bits by unity get the end bit right shift the bits by unity add that bit to our ans return the bit string of an integer get_reverse_bit_string 9 10010000000000000000000000000000 get_reverse_bit_string 43 11010100000000000000000000000000 get_reverse_bit_string 2873 10011100110100000000000000000000 get_reverse_bit_string this is not a number traceback most recent call last typeerror operation can not be conducted on a object of type str take in an 32 bit integer reverse its bits return a string of reverse bits result of a reverse_bit and operation on the integer provided reverse_bit 25 00000000000000000000000000011001 reverse_bit 37 00000000000000000000000000100101 reverse_bit 21 00000000000000000000000000010101 reverse_bit 58 00000000000000000000000000111010 reverse_bit 0 00000000000000000000000000000000 reverse_bit 256 00000000000000000000000100000000 reverse_bit 1 traceback most recent call last valueerror the value of input must be positive reverse_bit 1 1 traceback most recent call last typeerror input value must be a int type reverse_bit 0 traceback most recent call last typeerror not supported between instances of str and int iterator over 1 to 32 since we are dealing with 32 bit integer left shift the bits by unity get the end bit right shift the bits by unity add that bit to our ans
def get_reverse_bit_string(number: int) -> str:
    
    if not isinstance(number, int):
        msg = (
            "operation can not be conducted on a object of type "
            f"{type(number).__name__}"
        )
        raise TypeError(msg)
    bit_string = ""
    for _ in range(32):
        bit_string += str(number % 2)
        number = number >> 1
    return bit_string


def reverse_bit(number: int) -> str:
    
    if number < 0:
        raise ValueError("the value of input must be positive")
    elif isinstance(number, float):
        raise TypeError("Input value must be a 'int' type")
    elif isinstance(number, str):
        raise TypeError("'<' not supported between instances of 'str' and 'int'")
    result = 0
    
    for _ in range(1, 33):
        
        result = result << 1
        
        end_bit = number % 2
        
        number = number >> 1
        
        result = result | end_bit
    return get_reverse_bit_string(result)


if __name__ == "__main__":
    import doctest

    doctest.testmod()