Skip to content

Instantly share code, notes, and snippets.

@vcancy
Created April 18, 2018 08:08
Show Gist options
  • Save vcancy/e8ed486a3a317e20506ff76e33afd34b to your computer and use it in GitHub Desktop.
Save vcancy/e8ed486a3a317e20506ff76e33afd34b to your computer and use it in GitHub Desktop.
decimal base to Any(<62) denary notation
def changeBase(n,b):
baseList = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
x,y = divmod(n,b)
if x>0:
return changeBase(x,b) + baseList[y]
else:
return baseList[y]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment