Python bin() function
The bin() function in Python returns the binary version for the specified integer.
Syntax
1 2 3 |
bin(x) |
Parameter
n: This parameter represents an integer or int value.
Return
This function returns a binary string for the specified integer or int object.
Example 1
1 2 3 4 5 6 |
# Python Program explaining # bin() built-in function x = bin(136) print('The bin() function returns: ',x) |
Output
1 2 3 |
The bin() function returns: 0b10001000 |