Created
January 20, 2021 21:48
-
-
Save ayubmetah/96840d6baa4dee16fb4e7e61c1e87b8d to your computer and use it in GitHub Desktop.
Converting in 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 toHex(dec): | |
digits = "0123456789ABCDEF" | |
x = (dec % 16) | |
rest = dec // 16 | |
if (rest == 0): | |
return digits[x] | |
return toHex(rest) + digits[x] | |
# numbers = [0, 11, 16, 32, 33, 41, 45, 678, 574893] | |
# for x in numbers: | |
# print(x, toHex(x)) | |
# for x in numbers: | |
# print(x, hex(x)) | |
#numbers = [0, 11, 16, 32, 33, 41, 45, 678, 574893] | |
for x in range(200): | |
print(x, toHex(x), hex(x), chr(x),) | |
# for x in range(200): | |
# print(x, hex(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment