This assignment is due right away,
but there is not that much to hand in.
If you already have Python and IDLE installed on your computer,
you do not need to complete step 1. If you have a Mac,
then Python already is installed, and you can use it as is, but
you might find it easier to do an installation that includes the
interactive development environment IDLE, which is what you will
see me demonstrating in class.
If you have not encountered Python before, you may want to
consult one of the many tutorials that are available free
online. Which tutorial is right for you depends on your
level as a programmer in other programming languages. If
you're already an experienced programmer, then Chapters 3-5 of
the
tutorial at python.org contains more than you will
need. If you're more of a neophyte programmer,
the
first half of the textbook Think Python, by Allen
Downey, may be more suitable. But I encourage to shop around.
1. Install Python
Install Python 2.7.6 from the appropriate link on
this page.
The installation is very simple; just click on the link
corresponding to your computer's operating system, and then
follow the instructions. (Note for Mac users: I have
occasionally had problems with the installation of the version
for Mac OS 10.6 or higher, but never with the version for OS
10.3 and higher.)
2. Download and run the sample programs
Make a folder in which you will store all your work.
Download the program
caesarcipher.py from
the course website and save it to your course folder.
Open the file
caesarcipher.py from the File
menu in IDLE, and select Run Module from the Run menu.
Then at the prompt in the Python Shell window, type
caesar_demo()
This will launch the demo of the Caesar Cipher. We will
describe the cipher itself in class this week---there's
not much to it!---but you don't need to understand how it works
to follow this demo. The program begins by stripping
spacing, punctuation and capitalization from the plaintext
message that you type, and displays the modified plaintext,
which is a string of lower case letters. It then encrypts
with a randomly chosen key and displays the ciphertext, and
finally decrypts the ciphertext under all 26 possible keys, and
displays the result. You should be able to locate your
original plaintext message among the displayed decryptions.
3. Decrypt a message
I wrote a message to you and encrypted it with the Caesar
Cipher. The ciphertext is
oazsdmfgxmfuazezaikagtmhqoaybxqfqpmeeuszyqzflqda
Find the plaintext.
To do this, you have run the function
all_decryptions
from the downloaded program using this string as an
argument. (For those who are just starting out in Python:
you have to enclose the string in quotes in the call to
all_decryptions, but please copy and paste rather than trying to
type the entire string. I will demonstrate this in class, with
different plaintext and ciphertext.) You will see a list
of all 26 possible decryptions, and should be able to identify
the one that makes sense.
4. Submit your result
Prepare a (very brief) text file containing the plaintext.
The plaintext will appear in the output from
all_decryptions
as a sequence of lower case letters without spaces, but in your
solution you should restore appropriate spacing and punctuation
to the best of your ability. Submit the file through Canvas.