Created
April 18, 2018 08:08
-
-
Save vcancy/e8ed486a3a317e20506ff76e33afd34b to your computer and use it in GitHub Desktop.
decimal base to Any(<62) denary notation
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 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