Question: This is test code, Exercise 5: Morse Code Encoder Morse code is a method used in telecommunication to encode text characters as standardized sequences of

This is test code,

Exercise 5: Morse Code Encoder Morse code is a method used in telecommunication to encode text characters as standardized sequences of two different signal durations, called dots and dashes (or dits and dahs). Morse code is named after Samuel Morse, an inventor of the telegraph (Wikipedia). Complete the function 'morseCode' that takes a string of letters and numbers as the only parameter and returns a string with its Morse code representation. Use a period to represent a dot, and a minus sign to represent a dash. The mapping from letters and numbers to dashes and dots is illus- trated in the following figure. HUOVOZ-IMOOD) OOO.NP The function should leave a single space between each sequence of dashes and dots and it should ignore any characters that are not letters or numbers. Example: The Morse code for 'Hello, World!' is shown below: Hint: use dictionaries to represent the Morse code table. def test_morse_code(): assert morseCode("Hello, World!") == assert ( morseCode("Testing, 1, 2, 3, Testing!") assert ( morseCode("1 is one! 2 is two?") )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
