import string
dict = {}
bool = False
user_string = input("Bitte gebe hier die Buchstaben ein, welche du Summieren möchtest:")
String_Num = ""
for i, char in enumerate(string.ascii_lowercase):
dict[i] = char # This is dictinoary.
for val in user_string.lower():
if(val.isdigit()):
print("Entschuldige, der Vorgang konnte nicht abgeschlossen werden!")
bool = True
break
for key, value in dict.items():
if(val == value):
String_Num = str(key 1)
# For spaces
String_Num = " "
if (not bool):
print(String_Num)
CodePudding user response:
Add just one line after the 'print(String_Num)'
print(sum(map(int, String_Num.split())))
I had to use Google translate, but it looks like you are trying to sum the letters that are inputted.