task given a positive int number return true if this number is power of 4 or false otherwise implementation notes use bit manipulation for example if the number is the power of 2 it s bits representation n 0 100 00 n 1 0 011 11 n n 1 no intersections 0 if the number is a power of 4 then it should be a power of 2 and the set bit should be at an odd position return true if this number is power of 4 or false otherwise powerof40 traceback most recent call last valueerror number must be positive powerof41 true powerof42 false powerof44 true powerof46 false powerof48 false powerof417 false powerof464 true powerof41 traceback most recent call last valueerror number must be positive powerof41 2 traceback most recent call last typeerror number must be an integer return true if this number is power of 4 or false otherwise power_of_4 0 traceback most recent call last valueerror number must be positive power_of_4 1 true power_of_4 2 false power_of_4 4 true power_of_4 6 false power_of_4 8 false power_of_4 17 false power_of_4 64 true power_of_4 1 traceback most recent call last valueerror number must be positive power_of_4 1 2 traceback most recent call last typeerror number must be an integer
def power_of_4(number: int) -> bool:
    
    if not isinstance(number, int):
        raise TypeError("number must be an integer")
    if number <= 0:
        raise ValueError("number must be positive")
    if number & (number - 1) == 0:
        c = 0
        while number:
            c += 1
            number >>= 1
        return c % 2 == 1
    else:
        return False


if __name__ == "__main__":
    import doctest

    doctest.testmod()