Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

This is test code,

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions