EdDoc: home/built-in_functions/bin
A built-in function.
Used to convert an integer number to a binary string.
This function is passed an integer.
the corresponding binary number as a string.
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.