Question: Python Write a function encode6(string, key) that does a keyword cipher using the keyword key to create the alternate alphabet by placing the key at
Python
Write a function encode6(string, key) that does a keyword cipher using the keyword key to create the alternate alphabet by placing the key at the beginning just before the other letters, except that if the key as repeated letters, the repeats are not put into the alternate alphabet. For example, if the key is 'earthman', then the alternate alphabet is 'earthmnbcdfgijklopqsuvwxyz', since the 'a' was repeated it only appears once where it first appeared. In that case, encode6('deed', 'earthman') would produce 'thht'. Letters from string which are not in the alphabet produce the last letter of the alternate alphabet. For example, encode6('deeds speak', 'earthman') produces 'thhtqzqnhei'. What is the result for encode6('morning glory', 'morning')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
