Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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") 'hello

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions