I'm trying to use the following code to convert a denary string into characters, but I'm having trouble converting them correctly.
# Set to true if testing. Will show lists that show the process.
testing = True
# Asks for the denary.
text = list(input('Enter the denary: '))
# Defining the list. 0 is there to allow the remover to work correctly.
doublesList = ['0']
# Split the numbers into doubles and append them to doublesList.
for i in range(len(text) - 1):
    current_item = text[i]
    next_item = text[i + 1]
    doubles = current_item + next_item
    doublesList.append(doubles)
if testing:
    print('\nunedited:\n', doublesList,'\n')
# Remove unnecessary numbers.
for item in doublesList:
    doublesList.remove(item)
if testing:
    print('edited:\n', doublesList,'\n')
# Replace the numbers with their letters.
for item in doublesList:
    if item == '01':
        doublesList[doublesList.index('01')] = 'a'
    elif item == '02':
        doublesList[doublesList.index('02')] = 'b'
    elif item == '03':
        doublesList[doublesList.index('03')] = 'c'
    elif item == '04':
        doublesList[doublesList.index('04')] = 'd'
    elif item == '05':
        doublesList[doublesList.index('05')] = 'e'
    elif item == '06':
        doublesList[doublesList.index('06')] = 'f'
    elif item == '07':
        doublesList[doublesList.index('07')] = 'g'
    elif item == '08':
        doublesList[doublesList.index('08')] = 'h'
    elif item == '09':
        doublesList[doublesList.index('09')] = 'i'
    elif item == '10':
        doublesList[doublesList.index('10')] = 'j'
    elif item == '11':
        doublesList[doublesList.index('11')] = 'k'
    elif item == '12':
        doublesList[doublesList.index('12')] = 'l'
    elif item == '13':
        doublesList[doublesList.index('13')] = 'm'
    elif item == '14':
        doublesList[doublesList.index('14')] = 'n'
    elif item == '15':
        doublesList[doublesList.index('15')] = 'o'
    elif item == '16':
        doublesList[doublesList.index('16')] = 'p'
    elif item == '17':
        doublesList[doublesList.index('17')] = 'q'
    elif item == '18':
        doublesList[doublesList.index('18')] = 'r'
    elif item == '19':
        doublesList[doublesList.index('19')] = 's'
    elif item == '20':
        doublesList[doublesList.index('20')] = 't'
    elif item == '21':
        doublesList[doublesList.index('21')] = 'u'
    elif item == '22':
        doublesList[doublesList.index('22')] = 'v'
    elif item == '23':
        doublesList[doublesList.index('23')] = 'w'
    elif item == '24':
        doublesList[doublesList.index('24')] = 'x'
    elif item == '25':
        doublesList[doublesList.index('25')] = 'y'
    elif item == '26':
        doublesList[doublesList.index('26')] = 'z'
    elif item == '27':
        doublesList[doublesList.index('27')] = ' '
    elif item == '28':
        doublesList[doublesList.index('28')] = '.'
    elif item == '29':
        doublesList[doublesList.index('29')] = ''
    elif item == '30':
        doublesList[doublesList.index('30')] = '\n'
# Print the finished list as a string.
print(''.join(doublesList))
Using the above code, entering the denary number "2908051212152830132527140113052709192702150228" should return "hello.\nmy name is bob.". However, as you can see, it returns "hello.my nam\ne is bob.":
Enter the denary: 2908051212152830132527140113052709192702150228
unedited:
 ['0', '29', '90', '08', '80', '05', '51', '12', '21', '12', '21', '15', '52', '28', '83', '30', '01', '13', '32', '25', '52', '27', '71', '14', '40', '01', '11', '13', '30', '05', '52', '27', '70', '09', '91', '19', '92', '27', '70', '02', '21', '15', '50', '02', '22', '28'] 
edited:
 ['29', '08', '05', '12', '12', '15', '28', '13', '25', '27', '14', '01', '13', '30', '05', '27', '09', '19', '27', '02', '15', '02', '28'] 
hello.my nam
e is bob.
Could anyone suggest a possible fix for this? Thanks. Apologies for the large amount of code.
This isn't a duplicate...
 
     
    