Created
July 17, 2018 11:02
-
-
Save mahenzon/772e1ed2e64165b41c93c29dc78eb0c7 to your computer and use it in GitHub Desktop.
Convert from int to bcd format and counterwise with pure python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bcd_to_int(n): | |
return int(('%x' % n), base=10) | |
def int_to_bcd(n): | |
return int(str(n), base=16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment