Exercise 1:
Write a Python program that takes a name (one name, first or last) and convert it into
its ASCII code (binary code) then print it. The program interprets each letter in the
name to its equivalent binary code. For example:
Enter a name, use a-z small letters only: sam
s
01110011
a
01100001
m
01101101
If the users enter 'sam' and hits return, the program would print each letter and it's
ASCII's code as shown above.
The restriction is to use the "encode.py" file for translating the letters into binary
code and backward. The "encode.py" file contains a mapping between the letters and
their ASCII codes. It has two lists: 1) a list of letters, 2) a list of ASCII code. The
indexes of corresponding letter and ASCII code matches and they are placed in
order. For example
Ltr[0] $\rightarrow$ bnr[0] for letter 'a' and '01100001' binary.
Ltr[23] $\rightarrow$ bnr[23] for letter 'x' and '01111000' binary.
Hence, if you want to find the ASCII code of the letter 'm', first you have to find
the index of the letter 'm' by using "ltr.index('m')". The returned index is
"12". Then you use the index "12" to find the binary by using "bnr[12]"
For simplicity, in these exercises and in the final test, the encoding is used for only
the 'a-z' small 26 letters and we assume fixed number of each binary code to be 8
digits.