Python 3 - EdDoc

EdDoc: home/built-in_functions/bin

bin()

A built-in function.
Used to convert an integer number to a binary string.

arguments:

This function is passed an integer.

returns:

the corresponding binary number as a string.

what it can do:

When passed an integer, bin() returns the corresponding binary number as a string:

>>> bin(5)
'0b101'

You will note that this has a binary label at the front which can be removed like this:

>>> my_binary_number = bin(5)[2:]
>>> print(my_binary_number)
101

Note that this is still actually a string.