My question can be understood below:
goodvalue=False
while (goodvalue==False):
try:
word=str(input("Please enter a word: "))
except ValueError:
print ("Wrong Input...")
else:
goodvalue=True
word=word.lower()
List=list(map(str,word))
lenList=len(list(map(str,word)))
listofans=[]
x=0
while (lenList-1==x):
if List[x]==str("a"):
listofans[x]=str("1")
x=x+1
elif List[x]==str("b"):
listofans[x]=str("2")
x=x+1
elif List[x]==str("c"):
listofans[x]=str("3")
x=x+1
It continues like that for all alphabets for a while... And then:
sumofnums=listofans[0]
y=1
while (lenList-2==y):
sumofnums+=listofans[y]
print ("The number is: ", sumofnums)
So basically, if I give hello, it should return 8 5 12 12 15. Any help is truly appreciated!