Objectives Assessed

  • Solve simple programming problems using Python.

Directions

Consider the following Secret Code:

Input Letter Output Letter
A Z
B Y
C X
D W
E V
F U
G T
H S
I R
J Q
K P
L O
M N
N M
O L
P K
Q J
R I
S H
T G
U F
V E
W D
X C
Y B
Z A

Write a python script that prompts the user to input a string, validates that the string is not empty and does not only contain spaces, converts each letter (aka the input letter) to the secret code output letter that corresponds to it in the table above, and displays the result to the screen. Note: any symbol that is not a letter will remain as is. This includes spaces.

You must create a dictionary of the table above and use this dictionary in your script to convert the input letter to the output letter.

Please make sure you follow the instructions below.

  • Call your program SecretCode.py and include the basic header in your program.
  • It must provide the functionality and items defined above.
  • Include comments in your code as required.
  • Compile and test your script.

Sample Runs

Note: not all possible runs are shown below.

Enter in the text...
Enter in the text...hello world
SVOOL DLIOW

Process finished with exit code 0
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.