this code should be in python: You should be using dictionaries for this question: Morse code: (A-Z) [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","- -","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.-- ","--.."] You are supposed to implement a function that takes a list of strings as its only parameter (called “words”). Each of the words can be transformed to Morse code by concatenation of several numbers in the above strings (without spaces). For example, the transformation of “ab” will be “.--...” (“.-” + “-...”). The word “ems” will also have the same transformation “.--...” (“.” + “--” + “...”). In this function, the goal is to return the number of the unique transformations in the “words” list. Here is an example (none of this is needed to be printed, the function will only return one integer):
this code should be in python:
You should be using dictionaries for this question:
Morse code: (A-Z)
[".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","- -","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.-- ","--.."]
You are supposed to implement a function that takes a list of strings as its only parameter (called “words”). Each of the words can be transformed to Morse code by concatenation of several numbers in the above strings (without spaces).
For example, the transformation of “ab” will be “.--...” (“.-” + “-...”). The word “ems” will also have the same transformation “.--...” (“.” + “--” + “...”). In this function, the goal is to return the number of the unique transformations in the “words” list. Here is an example (none of this is needed to be printed, the function will only return one integer):
Step by step
Solved in 2 steps with 2 images