Skip to content

Commit

Permalink
Merge pull request #5000 from kevyder/challenge-30
Browse files Browse the repository at this point in the history
Reto #30 - Python
  • Loading branch information
kontroldev authored Sep 15, 2023
2 parents 0b52e13 + 8665e56 commit fd9fe8f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Retos/Reto #30 - EL TECLADO T9 [Media]/python/kevyder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
KEY_MAPPING = [
[" "],
[",", ".", "?", "!"],
["A", "B", "C"],
["D", "E", "F"],
["G", "H", "I"],
["J", "K", "L"],
["M", "N", "O"],
["P", "Q", "R", "S"],
["T", "U", "V"],
["W", "X", "Y", "Z"],
]


def t9_interpeter(input: str) -> str:
output = str()
for block in input.split("-"):
number = int(block[0])
index = len(block) - 1
char = KEY_MAPPING[number][index]
output += char

return output


if __name__ == "__main__":
test_case = "6-666-88-777-33-3-33-888"
output = t9_interpeter(test_case)
print(output)

0 comments on commit fd9fe8f

Please sign in to comment.