Question: use python please 3 plete out of question Complete the encode(text, jumbled_alphabet, step) function that takes 3 parameters: 1. The string parameter text which is

3 plete out of question Complete the encode(text, jumbled_alphabet, step) function that takes 3 parameters: 1. The string parameter text which is the string that needs to be encoded. 2. The string jumbled_alphabet which is a string containing the letters of the alphabet in jumbled order. This string will be used in the encoding process 3. The integer step which will also be used in the encoding process. The encode() function only encodes alphabetical characters. Non-alphabetical characters in text are left unchanged. You can assume that all the alphabetical characters will be in lowercase. For each alphabetical character in text: The index of this character in the jumbled alphabet is found The step is added to this index. You need to make sure that the resulting index is a valid one. For example, if after adding step, the index is 27, it should be adjusted to 1 The character at the new index is the encoded Character The function returns the encoded text. Some examples of the function being used are shown below. For example: Test Result hello world ---> qxeey hyzen jumbled_alphabet - "ayxonbyeeskutafndlichopa" stop 5 text = "hello world" encoded_text-encode(text, funbled_alphabet, step) print(text," --->", encoded_text) The encode() function only encodes alphabetical characters. Non-alphabetical characters in text are left unchanged. You can assume that all the alphabetical characters will be in lowercase. For each alphabetical character in text: The index of this character in the jumbled alphabet is found The step is added to this index. You need to make sure that the resulting index is a valid one For example, if after adding step the index is 27, it should be adjusted to 1. The character at the new index is the encoded character The function returns the encoded text. Some examples of the function being used are shown below. For example: Test Result hello world -> qxeey hyzer jumbled_alphabet - "qyxmbvgeskutofnujlichoep" step = 5 text = "hello world" encoded_text-encode(text, Jumbled_alphabet, step) print(text,">", encoded_text) Jumbled_alphabet - "yfaqpuwidjvzextokshirebug step - 7 text - Mid number: 12345" encoded_text - encode(text, Jumbled_alphabet, step) print(text," -->", encoded_text) id number: 12345 --> fo euphal 12345 Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Reset answer 1def encode(text, jumbled_alphabet, step)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
