Python bin() built-in function

From the Python 3 documentation

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.

Examples

>>> bin(1)
# '0b1'

>>> bin(10)
# '0b1010'

>>> bin(100)
# '0b1100100'

>>> bin(1000)
# '0b1111101000'

Ups! Nothing here yet!

This is a great opportunity for you to collaborate! Hit the link at the end of this page and add some examples and a brief description. If you don't know where to start, the Python 3 documentation will lead you in the right direction.

Subscribe to pythoncheatsheet.org

Join 10.700+ Python developers in a two times a month and bullshit free publication , full of interesting, relevant links.