morse(sentence): returns a string that is a conversion of sentence into Morse code . Morse code uses dots and dashes to represent letters. Letters in the same word must be separated by one space,...


Implement the following function. - Code should be in Python:



Morse Code:


code = {
  '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': '--..',
  }


morse(sentence): returns a string that is a conversion of sentence into Morse code . Morse code uses dots and<br>dashes to represent letters. Letters in the same word must be separated by one space, different words will be<br>separated by a slash surrounded by spaces (see examples below). You can assume that the sentence will only contain<br>letters and spaces. There is no distinction between uppercase and lowercase letters. You will need to build a<br>dictionary with each letter as a key and the Morse conversion as a value.<br>

Extracted text: morse(sentence): returns a string that is a conversion of sentence into Morse code . Morse code uses dots and dashes to represent letters. Letters in the same word must be separated by one space, different words will be separated by a slash surrounded by spaces (see examples below). You can assume that the sentence will only contain letters and spaces. There is no distinction between uppercase and lowercase letters. You will need to build a dictionary with each letter as a key and the Morse conversion as a value.

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here