We want to translate into Morse code message written using only capital vowels that is hidden in a string .
For example, if
= “LALALAlalala” the message is “AAA” and its
translation to Morse code is “.- .- .-”.
Implement the function @morse_vowel_translator (dic_morse_vow, s)@ such that given the dictionary @dic_morse_vow@ whose keys are the capital vowels and their values their respective Morse codes, returns the translation of the message hidden at . To find this message, you have to extract from the capital vowels that it contains, preserving the order in which they appear. The translation of the message is simply the Morse code of each capital vowel, separated by a blank space. In case the message is empty, an empty string must be returned.
Observation
The dictionary @dic_morse_vow @ =
“A”:“.-”,“E”:“.”,“I”:“..”,“O”:“---”,“U”:“..-”
will be given in private test cases.
>>> dic_morse_vow = {"A":".-","E":".","I":"..","O":"---", "U":"..-"} >>> morse_vowel_translator(dic_morse_vow,"LALALAlalala") '.- .- .-' >>> morse_vowel_translator(dic_morse_vow,"AaEeIiOoUu") '.- . .. --- ..-' >>> morse_vowel_translator(dic_morse_vow,"aeiou") '' >>> morse_vowel_translator(dic_morse_vow,"UOIAE") '..- --- .. .- .' >>> morse_vowel_translator(dic_morse_vow,"AIAIAIAI") '.- .. .- .. .- .. .- ..' >>> morse_vowel_translator(dic_morse_vow,"A") '.-' >>> morse_vowel_translator(dic_morse_vow,"E") '.' >>> morse_vowel_translator(dic_morse_vow,"I") '..' >>> morse_vowel_translator(dic_morse_vow,"O") '---' >>> morse_vowel_translator(dic_morse_vow,"U") '..-'