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

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter16: Graphics
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

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
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.
Transcribed Image 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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT