Python bin() method is a built-in method. It returns a binary string of an integer number. The binary string prefixed with “0b”.
Parameter | Description |
---|---|
x | (Required) This argument is an integer number. |
It returns a binary string of an integer value.
Let’s first understand, how this method works and what does it return?
As you can see, in the above example, both values are integer and converted to binary by prefix '0b' to the generated value.