Question: The part where to write the program code is marked with a comment #WRITE YOUR CODE HERE. In this task a sequence of Morse characters

 The part where to write the program code is marked with

The part where to write the program code is marked with a comment \#WRITE YOUR CODE HERE. In this task a sequence of Morse characters is to be translated into the Latin alphabet. This sequence of Morse characters is stored in the form of individual strings in a list morse_strings, Code cell: which is passed to the function morse. It is assumed that each element of the list morse_strings corresponds to the Morse code of a specific letter of the Latin alphabet. The morse function shall global morse_dict translate each Morse code (element of the list) character by character into the Latin alphabet and store the Latin letters in the appropriate order in a list latin_letters. The list latin_letters is to be returned by the function morse. The globally defined dictionary morse_dict is to be used for the translation. As an example the following code is given: morse_strings =[1,,1,] latin_sos = morse(morse_strings) \# WRITE YOUR CODE HERE print(" join(latin_sos)) The execution of this code should return a string SOS using the dictionary morse_dict. If a character (element of the list morse_strings) is not contained in the dictionary morse__dict, a \& is to be inserted as a placeholder for this unknown character at the corresponding position of the list latin_letters. A program abort due to a runtime error is to be prevented by appropriate exception handling. Modify your implementation of the function morse(morse_strings) accordingly. number of successfully translated Morse characters. The final value of this counter is to be returned as the second return value from the morse function. The following example code is given for clarification. Note that the strings consisting of 5 characters are not included in the dictionary morse_dict here. morse_strings =[1,,,1,,,1, ' latin_sos_with_missing_values, n_translated_signs = morse(morse_strings) print("'.join(latin_sos_with_missing_values)) print('Translated signs: \%d' \% n_translated_signs) The desired output of this example should look like the following: S\&OS\& Translated signs: 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!