Skip to content

Instantly share code, notes, and snippets.

@joefutrelle
Created March 14, 2014 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joefutrelle/9554679 to your computer and use it in GitHub Desktop.
Save joefutrelle/9554679 to your computer and use it in GitHub Desktop.
Example of conversion to non-base-10 base for Sean
DIGITS='0123456789ABCDEF'
k=34587
n=16
result = ''
while k > 0:
digit = k % n
result = DIGITS[digit] + result
k = (k-digit) / n
print result
@joefutrelle
Copy link
Author

the output of this is "871B"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment