Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 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.

image text in transcribed

image text in transcribed

Python

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. tion 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 nelloorld gxeezer jumbled_alphabet = "ambvgeskutafndwjlichoepz" step = 5 text = hello world" encoded_text= encode(text, Jumbled_alphabet, step) print text,---,encoded_text) id number: 12345 - fo geupha: 12345 dumbled_alphabet - my faapuulajvzextoksnhircomg" step text = "id number: 12345" encoded_text= encode(text, tumbled_alphabet, step) print(text," encoded_text) For example: Test Result hello world ---> qxeey hyzer jumbled_alphabet "qyxmbvgcskutafndwjlirhoepz". step = 5 text "hello world" encoded_text encode(text, jumbled_alphabet. Step) print(text," --->", encoded_text) id number: 12345 ---> fo geupha: 12345 jumbled_alphabet = "yfaqpuwldjvzextoksnhircomgi step text "id number: 12345" encoded_text encode(text, jumbled_alphabet, step) print(text," --->", encoded_text)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

=+to digest detailed information and make informed recommendations?

Answered: 1 week ago

Question

LO6.1 Discuss price elasticity of demand and how it is calculated.

Answered: 1 week ago