Write a Python program that asks the user to enter a string of lowercase characters, and then print the corresponding two-digit code. For example, if the input is " home", the output should be " 08151305".
Currently my code is working for me to compile a list of the whole number, but I cannot get it to add 0 in front of numbers with one digit.
def word ():
output = []
input = raw_input("please enter a string of lowercase characters: ")
for character in input:
number = ord(character) - 96
output.append(number)
print output
This is the result I get:
word()
please enter a string of lowercase characters: abcdefghijklmnopqrstuvwxyz
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
I think I may need to change the list to a string or to integers to do this, but I'm not sure how to do this.