Built-in Functions
bin()
Convert an integer to a binary string.
bin(number)
bin() shows an integer in base 2. The result begins with 0b to mark it as binary.
Arguments
Parameters
| Name | Description |
|---|---|
| number | An integer, or an object that defines integer conversion. |
Result
Returns
A binary string beginning with 0b.
Run it
Try it
Run it and change it
number = 10 print(bin(number))
Output
Press Run to see what it prints.