Mobile Display Keystrokes

Do you remember the old mobile display keyboards? Do you also remember how inconvenient it was to write on it?
Well, here you have to calculate how much keystrokes you have to do for a specific word.

This is the layout:



Return the amount of keystrokes of input str (! only letters, digits and special characters in lowercase included in layout without whitespaces !)

e.g:


mobileKeyboard("123") => 3 (1+1+1)
mobileKeyboard("abc") => 9 (2+3+4)
mobileKeyboard("codewars") => 26 (4+4+2+3+2+2+4+5)

Difficulty: introductory

Starter code:

def mobile_keyboard(s):
	

Solutions:
def mobile_keyboard(s):
    lookup = {
        c: i 
        for s in "1,2abc,3def,4ghi,5jkl,6mno,7pqrs,8tuv,9wxyz,*,0,#".split(",") 
        for i, c in enumerate(s, start=1)
    }
    return sum(lookup[c] for c in s)

def mobile_keyboard(s):
    return sum((x+1) for x in range(5) for c in s if c in ['0123456789*#','adgjmptw','behknqux','cfilorvy','sz'][x])


STROKES = {'0':1, '1':1, '2':1, '3':1, '4':1, '5':1, '6':1, '7':1, '8':1, '9':1,
           'a':2, 'b':3, 'c':4, 'd':2, 'e':3, 'f':4, 'g':2, 'h':3, 'i':4, 'j':2,
           'k':3, 'l':4, 'm':2, 'n':3, 'o':4, 'p':2, 'q':3, 'r':4, 's':5, 't':2,
           'u':3, 'v':4, 'w':2, 'x':3, 'y':4, 'z':5, '*':1, '#':1}

mobile_keyboard = lambda message: sum(STROKES[char] for char in message)

D = {}
for c in "0123456789*#": D[c] = 1
for c in "adgjmptw": D[c] = 2
for c in "behknqux": D[c] = 3
for c in "cfilorvy": D[c] = 4
for c in "sz": D[c] = 5

def mobile_keyboard(s):
    return sum(map(D.get, s))

def mobile_keyboard(s):
    a = "12abc3def4ghi5jkl6mno7pqrs8tuv9wxyz*0#"
    b = "11234123412341234123412345123412345111"
    d = {x: int(y) for x, y in zip(a, b)}
    return sum(d[x] for x in s)

keys = ["123456789*0#", "adgjmptw", "behknqux", "cfilorvy", "sz"]

def mobile_keyboard(s):
        return sum(i + 1 for i, k in enumerate(keys) for c in s if c in k)

from string import ascii_lowercase as alc, digits
def mobile_keyboard(s):
    return sum(map(int, s.translate(str.maketrans('*#' + digits + alc, '1' * 12 + '234' * 6 + '5' + '234' * 2 + '5'))))

count =       {chr(n):2+i%3 for i,n in enumerate(range(ord('a'), ord('s')))}
count.update( {chr(n):2+i%3 for i,n in enumerate(range(ord('t'), ord('z')))} )
count.update( {str(n)[-1]:1 for i,n in enumerate(range(1,11))} )
count.update( {'s':5, 'z':5, '*':1, '#':1} )

def mobile_keyboard(s):
    return sum(count[c] for c in s)

keyboard = {
  '1': 1,
  '2': 1, 'a': 2, 'b': 3, 'c': 4,
  '3': 1, 'd': 2, 'e': 3, 'f': 4,
  '4': 1, 'g': 2, 'h': 3, 'i': 4,
  '5': 1, 'j': 2, 'k': 3, 'l': 4,
  '6': 1, 'm': 2, 'n': 3, 'o': 4,
  '7': 1, 'p': 2, 'q': 3, 'r': 4, 's': 5,
  '8': 1, 't': 2, 'u': 3, 'v': 4, 
  '9': 1, 'w': 2, 'x': 3, 'y': 4, 'z': 5,
  '0': 1, '*': 1, '#': 1
}
def mobile_keyboard(s):
    sum = 0
    for k in s:
        sum += keyboard[k]
    return sum


def mobile_keyboard(s):
    result = 0; s = list(s)
    key = {'0':1,'1':1,'2':1,'3':1,'4':1,'5':1,'6':1,'7':1,'8':1,'9':1,'a':2,'b':3,'c':4,'d':2,'e':3,'f':4,'g':2,'h':3,'i':4,'j':2,'k':3,'l':4,'m':2,'n':3,'o':4,'p':2,'q':3,'r':4,'s':5,'t':2,'u':3,'v':4,'w':2,'x':3,'y':4,'z':5,'*':1,'#':1};
    for a in s:
        result += key[a]
    return result