bin

bin(x)

Returns the number converted to a binary string (built-in).

x

REMARKS
* No prefix required - Core
* Convert an integer number to a binary string prefixed with "0b". The result is a valid Python expression.
* If x is not a Python int object, it has to define an __index__() method that returns an integer.
* You can use the HEX function to
* You can use the OCT function to
* For the Official documentation refer to python.org

>>> bin(3) 
'0b11'
>>> bin(-10)
'-0b1010'

>>> format(14, '#b'), format(14, 'b')
('0b1110', '1110')
>>> f'{14:#b}', f'{14:b}'
('0b1110', '1110')

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top