bin(x)

Returns test


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.

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

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

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