Skip to content

Commit

Permalink
Merge pull request #5368 from marcoatrs/main
Browse files Browse the repository at this point in the history
Reto #30 - Python
  • Loading branch information
Roswell468 authored Oct 13, 2023
2 parents 27dd9c6 + dd78282 commit 1569838
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Retos/Reto #30 - EL TECLADO T9 [Media]/python/marcoatrs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
teclado_t9 = [" ", ",.?", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]

def convertir_pulsaciones(texto: str) -> str:
pulsaciones = texto.split("-")
salida = ""
for pulsacion in pulsaciones:
if not pulsacion.isdigit():
print("Formato incorrecto")
return
if not all([c == pulsacion[0] for c in pulsacion]):
print(f"La pulsacion {pulsacion} no es igual")
salida += teclado_t9[int(pulsacion[0])][len(pulsacion) - 1]
return salida

print(convertir_pulsaciones("6-2-777-222-666-0-2-66-8-666-66-444-666"))

0 comments on commit 1569838

Please sign in to comment.