0
The code below takes a decimal number and converts to bases from 2 to 9
def converte(numDecimal, base):
if numDecimal != 0:
numConvertido = ""
while numDecimal > 0:
resto = numDecimal % base
numConvertido = str(resto) + numConvertido
numDecimal = numDecimal // base
else:
numConvertido = "0"
return numConvertido
n = int(input())
while n != -1:
for b in range(2, 9 + 1):
r = converte(n, b)
print(r, end=" ")
print()
n = int(input())
If now I want to do the opposite, and receive a binary number and convert to bases from 3 to 10, for example, as I would?
The simplest is to interpret the binary as decimal and then use the function you already have of convesion to other bases
– Isac