I got this calculator that turns each letter in a word to its corresponding number in the alphabet. For example, if you enter the word "the", you get [20, 8, 5]. How can I make it so that the numbers in the list are added? Also, how can I make it so that each digit of the number is added? For example, for the word "the", I want two outputs. I want 33 and 6. Thanks for the help!
1 2 3 4 5 6 7 |
input = raw_input ( 'Write Text: ' ) input = input .lower() output = [] for character in input : number = ord (character) - 96 output.append(number) print output |