Last active
March 2, 2021 18:29
-
-
Save VxDxK/afef79e6a77c5bb6449070f847f6f6fc to your computer and use it in GitHub Desktop.
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 toBase(base, num): | |
newNum = '' | |
while num > 0: | |
newNum = str(num % base) + newNum | |
num //= base | |
return newNum | |
def toDec(num, base): | |
iu = str(num) | |
s = 0 | |
t = 0 | |
yr = 0 | |
for i in range(len(iu) - 1, -1, -1): | |
s += int(iu[i]) * (base ** yr) | |
yr += 1 | |
return s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment