Pager:
Imagine a paper with only one button. for the letter "A", you press the button one time, for "B", you press it 2 times for "E", you press it five times. for "G", it's pressed seven times, etc.
Given a string s, print the total number of times the button should be pressed
explanation: given string is abde. then the total no. of times the button pressed is 1+2+4+5=12
I/p: abde
O/p: 12
I/p: xyz
O/p: 75
import string
answer = 0
for i in input("Input sting: ").lower():
answer += string.ascii_lowercase.find(i) + 1
print(answer)
Comments
Leave a comment