Programming Assignment: Assignment Overview
This assignment will give you some experience with dictionaries, as well as some more practice with file I/O.
Part 1: Phone keypads
The international standard letter/number mapping found on the telephone is shown below:
1
2 ABC
3 DEF
4 GHI
5 JKL
6 MNO
7 PQRS
8 TUV
9 WXYZ
0
Write a function that returns a number, given an uppercase letter, as follows:
def getNumber(uppercaseLetter):
Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (upper- or lowercase) to a digit and leaves all other characters intact.
Part 2: File Encryption and Decryption [75 points]
Write a program that uses a dictionary to assign "codes" to each letter of the alphabet.
For example:
codes = { ' A' : ' %' , ' a' : ' 9' , ' B' : ' @' , ' b' : ' #' , etc...}
Using this example, the letter A would be assigned the symbol %, the letter a would be assigned the number 9, the letter B would be assigned the symbol @, and so forth.
The program should open a specified text file, read its contents, and then use the dictionary to write an encrypted version of the file's contents to a second file. Each character in the second file should contain the code for the corresponding character in the first file.