Program 2 for Comp 150:  Secret Code

This is a pair assignment worth 20 points.

The program should begin with a comment including your names, a brief description of what the program does and information on any help you received on the project.  If it is entirely your own work, say so.  If anyone helped either of you, identify them by name and describe how they helped. 

Remember to have each team member separately also submit a log to Blackboard.  It is described in the Pairs Administration page:  The log should indicate your hours working on the homework and an assessment of your contribution and an assessment of your partner's contribution.  Please name the file 150log2ID.doc, where ID is your blackboard ID, and the 2 refers to Program 2, so if I were submitting a log for this assignment, it would be called 150log2aharrin.doc.  Your program grade will not be recorded until after your log submission.  

This program will read and write to a file.   Choose a number from 1-5 which will be your encoding secret.  You will write two programs:  the encode program and the decode program.  Put them both as separate functions in the same file with names encode() and decode().
  1. Choose another programming team in the class to exchange coded messages with. Exchange email addresses.
  2. Prepare a few line message that you want to send to the other team.  This should be an ordinary text file written in the Idle editor, and given a name ending in .txt
  3. Read in your file and encode your message by  calculating the ord of each character and SUBTRACTING your chosen secret number.  Write the resulting number to your output file.  Put each on a new line.  This is the encoded message
  4. Write an e-mail message to the other team and tell them your secret number.  Attach the encoded file.
  5. Write your decoder.  You will get an e-mail from the other team.  It will reveal the secret code and the file will be attached.  Decode the message by reading each number from the file,  and convert it back to the appropriate character by using the information in the email.  Attach the new character to an accumulator string.  Remember there are several transformations needed, since the numbers in the encoded file will be text in the file, not Python ints! 
  6. When you print your string, it should be the message.
Hand in one file prog2_ID.py identifying you, your partner, who you received a message from, who you sent a message to, the source code from both programs, and Python comments containing the coded message you received, and the plain text message you decoded.  Please label each section.  Add  a brief paragraph in a comment block at the end, describing how well everything worked and if you had any problems. 

You must send the encrypted message to the other team no later than Tuesday night, February 21, to give them time to decode it and turn in their homework file by Thursday.