Multi-tap Keypad Text Entry
Multi-tap Keypad Text Entry
This is a fun code to show how many taps were required to send messages via numeric keypads.
*Featured Code Submitted and Created By VENOM666
# Multi-tap Keypad Text Entry (from Codewars)
# by: VENOM666
"""
Prior to having fancy iPhones, teenagers would wear out their thumbs sending SMS messages on candybar-shaped feature phones with 3x4 numeric keypads.
Prior to the development of T9 (predictive text entry) systems, the method to type words was called "multi-tap" and involved pressing a button repeatedly to cycle through the possible values.
For example, to type a letter "R" you would press the 7 key three times (as the screen display for the current character cycles through P->Q->R->S->7). A character is "locked in" once the user presses a different key or pauses for a short period of time (thus, no extra button presses are required beyond what is needed for each letter individually). The zero key handles spaces, with one press of the key producing a space and two presses producing a zero.
In order to send the message "WHERE DO U WANT 2 MEET L8R" a teen would have to actually do 47 button presses.
"""
Python
keyStrokes = {1 : ['!', '1'], 2 : ['!', 'A', 'B', 'C', '2'], 3 : ['!', 'D', 'E', 'F', '3'], 4 : ['!', 'G', 'H', 'I', '4'], 5 : ['!', 'J', 'K', 'L', '5'], 6 : ['!', 'M', 'N', 'O', '6'], 7 : ['!', 'P', 'Q', 'R', 'S', '7'], 8 : ['!', 'T', 'U', 'V', '8'], 9 : ['!', 'W', 'X', 'Y', 'Z', '9'], 0 : ['!', " ", "0"]}
def keystrokeCount(phrase):
keyPresses = 0
for ch in phrase:
for key, value in keyStrokes.items():
if ch in value:
keyPresses += keyStrokes[key].index(ch)
print(phrase + ": " + str(keyPresses) + " keystrokes")
keystrokeCount("WHERE DO U WANT 2 MEET L8R")
It was good explanation and it looks more impressive!thank you for sharing precious information with us..
ReplyDeleteData Analytics Courses in Chennai
Xamarin Training in Chennai
Node JS Training in Chennai
Big Data Analytics in Chennai
Data Analytics Certification Courses in Chennai
The Blog is really very beautiful every concept should be very uniquely represented.
ReplyDeleteData Science Training Course In Chennai | Data Science Training Course In Anna Nagar | Data Science Training Course In OMR | Data Science Training Course In Porur | Data Science Training Course In Tambaram | Data Science Training Course In Velachery
Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog.
ReplyDeleteData Science Training
Stupendous blog huge applause to the blogger and hoping you to come up with such an extraordinary content in future. Surely, this post will inspire many aspirants who are very keen in gaining the knowledge. Expecting many more contents with lot more curiosity further.
ReplyDeleteDigital Marketing training in Bhilai
Do you have video on tiktok how you make it? On this site https://soclikes.com/buy-tiktok-likes you can buy tiktok likes for it
ReplyDeleteImpressive blog to be honest definitely this post will inspire many more upcoming aspirants. Eventually, this makes the participants to experience and innovate themselves through knowledge wise by visiting this kind of a blog. Once again excellent job keep inspiring with your cool stuff.
ReplyDeleteDigital Marketing training in Bhilai
Truly mindblowing blog went amazed with the subject they have developed the content. These kind of posts really helpful to gain the knowledge of unknown things which surely triggers to motivate and learn the new innovative contents. Hope you deliver the similar successive contents forthcoming as well.
ReplyDeleteDigital Marketing Course
I am here to share my site with you Mobile Prices Bangladesh
ReplyDelete
ReplyDeleteBest University for Paramedical in Roorkee