Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 5 2 0 Marks I Write a function called text encode that takes in a string and a codebook and for each letter converts
Question
Marks
I
Write a function called text encode that takes in a string and a codebook and for each letter converts it to the encoded version of our text.
The input will be a string of undefined length containing the characters and the literal space
The codebook has to be at least as long as the string being encoded. For each step you will pull a character from the text to encode, and a char from the codebook, encode them and append the result to a string for return.
NOTE that codebooks and input strings used for testing will be valid they will only contain AZ az and and the codebook will be of appropriate length or longer
def textencodetexttoencode:str codebook:str str:
# YOUR IMPLEMENTATION
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