Caesar Cipher (P.163 Ex.7)
Specification
- Input:
- A word to encode.
- An integer as the key.
- Output:
An encoded word.
- Relationship: ch is encoded as chr(ord(ch) + key)
The pseudo code of the program may look like:
============
Get a word to encode.
Get a number as the key.
Each each character ch in the word,
output chr(ord(ch) + key).
The program may run as follows:
Message - ABC
key - 3
DEF
or
Message - SBWKRQIRUILQDQFH
key - 23
PYTHONFORFINANCE