I have this code with input for example of 34, 56 and supposed output of 28,46. However, what I am getting as output is: 24, 4, 40,6 (24+4 = 28 and 40 + 6 = 46). Question is, what line of code am I missing?
def decode(code):
decimals = []
code = code.split(" ")
for number in code:
length = len(number)
for digit in number:
decimal = int(digit) * (8**(length - 1))
decimals.append(decimal)
length -= 1
print(decimals)