Number to Binary Conversion in Python
If you have a decimal number, and want to get it’s binary value, you can use the built-in bin
method.
We can see that it prepends the string with a 0b
.
Let’s remove this to return a usable binary value:
If you have a decimal number, and want to get it’s binary value, you can use the built-in bin
method.
We can see that it prepends the string with a 0b
.
Let’s remove this to return a usable binary value: