Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer in Python. Exercise Type these expressions in the python shell. > ord (a) >chr(97) ord (a) +5 > ord (A) > ord (
Please answer in Python.
Exercise Type these expressions in the python shell. > ord ("a") >chr(97) ord ("a") +5 > ord ("A") > ord (" z ") chr(102) chr(ord("f")5) Problem 1 Write a recursive function encode that takes a string as an input. For each character in the string add 5 to its ord value and then convert it to a character by using chr. Also write another function decode that takes a string as input and subtracts 5 from each character to return the original string. Note that number 5 acts as a key which the person encoding and decoding must have to decipher the message. Each character on the keyboard has an equivalent ord number which comes from the ASCII table. (See ASCII table - https://ascii.cl/). [Hint: Remember string are like list hence they can be manipulated like lists] encode ("hello") 'mjqqt' > decode ("mjqqt") 'helloStep 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