Python achieve conversion between decimal and binary
Others
2019-08-05 18:10:04
views: null
Binary Decimal turn
- Principle: The addition modulo 2, the output in reverse order.
- Implementation: decimal integer divisible by 2, can get a quotient and a remainder; then removing provider 2, will get a quotient and a remainder, so until the time until the supplier of less than 1, and then sorted to obtain sequentially inverted binary number, in Python we adopt "//" (except the floor) ways to achieve the conversion
Binary Coded Decimal
- Principle: To right to left with each binary number to a power of 2 multiplied by the corresponding cumulative demand.
Origin www.cnblogs.com/ddpeng/p/11302368.html