Question
After spending some time on this new continent, you decided to map the English language to the local tongue. As it turns out, there was
After spending some time on this new continent, you decided to map the English language to the local tongue. As it turns out, there was a simple cipher that you could use to translate directly! To this end, you decided to help future explorers by designing a Python algorithm that would translate single words into the local equivalent.
The cipher operated as follows:
Each vowel (AEIOU) became the next vowel in order, so A->E, E->I, etc...U -> A
Each consonant (everything else) became the third next consonant in order, so B->F, C->G etc...
Your function should take in a word and then map each character to the proper local converted character and subsequently return the converted word. You must use the map operator in your conversion.
Your code should work for both: capital letters and lower case letters. The output should be in lower case letters.
Note: a word in this assignment is defined as a string with one or more alphabetic characters.
Hints:
1. You may want to create two lists: one for vowels, another one for consonant letters.
2. method index() might be helpful: Link
3. Use % (mod operation) to wrap around the list.
def cipher map (english word): IT T1 >>>cipher map ('hello') lippu" >>>cipher map ('today) xuhec >>>cipher map ('yesterday) CIWXivhec # YOUR CODE GOES HERE #Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started