Question: Must be in python. Write a function custom_encoder () to encode a character from original messages, using our custom encoding scheme (defined below). This function
Must be in python.
Write a function custom_encoder () to encode a character from original messages, using our custom encoding scheme (defined below). This function should take two input parameters: - | the character to be encoded using our custom encoding scheme - key | the key to be used in encoding (int; default: 200) Within the function, carry out the following: - Define the dictionary custom_encodings (provided at end of this cell) - If char is a key in the custom_encodings dictionary, store the corresponding value from the dictionary in output_char (i.e. if the function would return ' n ') - Otherwise, use the encoder() function you wrote earlier, storing the output in output_char, being sure to pass both and in as inputs. Be sure to return the encoded character (output_char) from the function custom_encodings ={ a ' :r ', 'e' : 'p', 'i' : 'm', 'o' : 'n', 'u' :s ' \} \# test for char in custom_encodings custom_encoded = custom_encoder('a') assert type (custom_encoded) == str assert custom_encoded == ' r
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
