Pager in Python | Assignment Expert

Problem Statement:

You are given a button, with that only one button available, we need to write all the alphabet. But, how this is possible? That only button outputs different results on clicking different number of times, for example, if you press the button 1 time, this means ‘a’ or ‘A’, 2 time means ‘b’ or ‘B’, 3 time means ‘c’ or ‘C’ and so on…
We are given a string, we need to write a Python code to find out how many times that button will be pressed to result in the string.
For example, ‘abcd’ => 1+2+3+4 =>10.

Code for Pager in Python:

s = input('Enter the string: ')
s = s.lower()
press_count = 0
for i in s:
    press_count += ord(i)-96
print(press_count)

Output:

Output for Pager in Python

Also Read:

Share:

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@violet-cat-415996.hostingersite.com Thank you