Python Bin


Bin function

The bin() function convert an integer number to a binary string.

Examples

Example 1

	
>>> bin(1)
'0b1'
>>> a = 1
>>> bin(a)
'0b1'
>>> 

Example 2

>>> bin(2)
'0b10'
>>> a = 1
>>> b = 1
>>> bin(a+b)
'0b10'
>>>