Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. def decode(word):
  2. dictionary = [
  3. [" "], #0
  4. ["a","b","c"], #2
  5. ["d","e","f"], #3
  6. ["g","h","i"], #4
  7. ["j","k","l"], #5
  8. ["m","n","o"], #6
  9. ["p","q","r","s"], #7
  10. ["t","u","v"], #8
  11. ["w","x","y","z"], #9
  12. ]
  13.  
  14. sample = word
  15. sample = sample.split(" ")
  16. for i in sample:
  17. try:
  18. if int(i[0]) == 0:
  19. print(dictionary[i])
  20. else:
  21. num = len(i)-1
  22. firstChar = int(i[0])-1
  23. print (dictionary[firstChar][num],end="")
  24. except:
  25. print("[not found]",end=" ")
  26. print()
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. #decode(input())
  34. #┌─[nightsec@greyxploiter]─[~/Documents/coding/test/go/lath_module]
  35. #└──╼ $python hp_jadul.py
  36. #2 22 222 3 33 333 4 44 444 5 55 555 6 66 666 7 77 777 7777 8 88 888 9 99 999 9999
  37. #abcdefghijklmnopqrstuvwxyz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement