https://realpython.com/python-bitwise-operators/ To print out in binary, use print(f"{42:b}") # Print 42 in binary # 101010 bin(42) #'0b101010'