PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#sum of letters in a string according to their position in the alphabet
i = input("Enter a string of letters:\n")
list = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
list2 = []
list3 = []
x = 0
for a in range(0,len(i)):
for b in range(0, len(list)):
if(i[a] == list[b]):
list2.append(i[a])
list3.append(b+1)
x+= b+1
print("Letters: " + str(list2))
print("Values: " + str(list3))
print("Total: "+ str(x))
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run