Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. mdict = {
  2. "a" : ".-",
  3. "b" : "-...",
  4. "c" : "-.-.",
  5. "d" : "-..",
  6. "e" : ".",
  7. "f" : "..-.",
  8. "g" : "--.",
  9. "h" : "....",
  10. "i" : "..",
  11. "j" : ".---",
  12. "k" : "-.-",
  13. "l" : ".-..",
  14. "m" : "--",
  15. "n" : "-.",
  16. "o" : "---",
  17. "p" : ".--.",
  18. "q" : "--.-",
  19. "r" : ".-.",
  20. "s" : "...",
  21. "t" : "-",
  22. "u" : "..-",
  23. "v" : "...-",
  24. "w" : ".--",
  25. "x" : "-..-",
  26. "y" : "-.--",
  27. "z" : "--..",
  28. " " : " "
  29. }
  30.  
  31. '''
  32. 1. input = message to translate to morse
  33. 2. iterate over the message (for loop)
  34. 3. translate each letter into morse
  35. 4. iterate over the entire morse code and
  36. break it down into individual symbols (for loop-ception)
  37. '''
  38.  
  39. uin = input('Message: ')
  40. for x in uin:
  41. print(x)
  42. print(mdict[x])
  43. mlet = mdict[x]
  44. for s in mlet:
  45. #print(s)
  46. if s == '.':
  47. print('1')
  48. elif s == '-':
  49. print('2')
  50. print('pause between alphabets')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement