PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
s=input()
flag=0
total=0
for i in s:
j=ord(i)
if j>=97 and j<=122:
total+=(j-96)
elif j>=65 and j<=90:
total+=(j-64)
else:
flag=1
break
if flag==0:
print("Sum of %s is ==> %d" %(s, total))
else:
print("Invalid input")
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run