Assignment 2 - Substitution-based Encryption

pdf

School

Simon Fraser University *

*We aren’t endorsed by this school

Course

120

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

2

Uploaded by xiaofanfan

Report
Assignment 2 - Substitution-based Encryption Due Wednesday by 11:59p.m. Points 20 Submitting a file upload File Types py Available Oct 4 at 10p.m. - Oct 11 at 11:59p.m. Start Assignment Title: Assignment 2 - Substitution-based Encryption Step 1 - Problem Statement Write a program that encrypts and decrypts messages (strings) using the Substitution algorithm called ROT13 (see Wiki (https://en.wikipedia.org/wiki/ROT13) for a description of this algorithm). Your program must keep instructing the user to ... Please, enter a message to encrypt/decrypt or enter an empty string to exit the program: until the user enters an empty string. When this occurs, your program must terminate. If the user enters a message (non-empty string), your program must encrypt this message, then decrypt its encrypted version and display the original message, the encrypted version as well as the decrypted version on the computer monitor screen. Requirements Your program must execute as expected on Python 3.11 IDLE and it must start when the menu option Run is selected or F5 is pressed. You must use the ROT13 Substitution algorithm as it is described by Wikipedia (https://en.wikipedia.org/wiki/ROT13) . No other descriptions are acceptable. You cannot use the Python implementations listed on this Wikipedia web site (and on any other web site for that matter). This is to say that ... You cannot use the module codecs and its functions such as encode(...) . You cannot use a list comprehension . (We shall cover list comprehensions later on this semester.) You cannot use a lookup table . You cannot use the functions maketrans(...) , translate(...) , join(...) and lambda . You must write your Python program on your own. Warning: If your program replicates any of the implementations found on Wikipedia or on any other web sites, you will get 0 for this assignment. :( In terms of the iterative statement (loop) in your program, it must make use of a Boolean condition (i.e., Boolean expression) which must evaluate to True and to False depending on the value assigned to the variable(s) contained in this Boolean expression and you cannot use break or exit( ) as part of the body of this iterative statement. You must include a header comment block with the four (4) sections we talk about in our lectures (filename, description, author, date) at the top of your program.
Your program must follow these Good Programming Style (GPS) rules : Programs (filenames), functions and variables must always be named in a descriptive fashion (describing their purpose). All import statements must be placed at the top of the file, immediately after the header comment block, before the functions and modules must only be included once per file . Each line of your code must not exceed 80 characters in length. Submit this .py file (containing your Python program) . W hen uploading, make sure you choose/navigate to the folder that contains your .py file. You are encouraged to expand on this assignment for enhancing your understanding, as long as it meets (satisfies) all the Requirements stated in this assignment. There are no extra points for this, but it will help you to learn more Python. Step 2 - Design Design your algorithm using English (natural language) or using pseudocode. Requirement You must include your algorithm as comments in your program. Step 3 - Implementation Then translate each of the steps of your algorithm (each comment) to Python code. Requirement You must leave the comments in the code. Step 4 - Testing Incremental development: Test as you go! This means: as you are translating your comments (algorithm steps) into Python statements, make sure your program executes as expected. How your Assignment 2 will be marked When the TA mark your Assignment 2, they will be looking at whether your program solves the problem (10 points) using a few test cases. For example, a message containing a mix of upper and lower case letters, a message containing a mix of letters and symbols (!, ", etc.), a message containing a mix of numbers and letters, an empty string. whether your program satisfies all the requirements stated in this assignment (10 points), regardless of whether or not your program executes. The rubric for Assignment 2 is based on the above. Make sure your program satisfies the above before submitting it as your Assignment 2. Finally, there are no extension granted unless for medical reason once the Official Medical Certificate (https://canvas.sfu.ca/courses/79704/files/22229208?wrap=1) has been completed and emailed to the instructor.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: Consider the cell: Pt(s) | H2(g, 0.100 bar) | H+(aq, pH = 2.54) || Cl−(aq, 0.200 M) | Hg2Cl2(s) |…
Q: Describe with examples how meaningful visual media (charts, diagrams, images, videos, and other…
Q: Find dy/dx by implicit differentiation of 6x3+x2y-xy3=4
Q: On December 31, 2020, Sarasota Co. performed environmental consulting services for Hayduke Co.…
Q: 6. What are the equilibrium concentrations of a 0.80 M HCN solution for each species (in M to two…
Q: ху 1-23 y =
Q: Foundation, Incorporated, is comparing two different capital structures: an all-equity plan (Plan I)…
Q: CHAPTER 17. Inference about a Population Mean Pair 1 2 3 Control plot 9.752 7.263 5.742 Treated plot…
Q: Question 18 Find - - -3 in terms of x and y &r & 16 کر ارولو
Q: Determine the volume (in liters) of a 0.331-mol sample of helium at 735 mmHg and 603 K.
Q: Describe the mechanism for moving acetyl-CoA produced in the mitochondrial matrix into the cytosol…
Q: Part 2. Predict the Organic Products. Predict the major organic product(s) for each of the following…
Q: You are in a helicopter towing a 128-kg laser detector that is mapping out the thickness of the…
Q: 3 Find y" if y=4x° +3x³ −8x³ +6x² +15
Q: Question 1 What is the equilibrium concentration (in M to three decimal places) of NO₂ for the…
Q: What is the percent by mass of Nitrogen in hexamidine? Molecular formula: C20H26N402. 9.3% 7.7% 33%…
Q: What quantum numbers does the energy of an electron in a multi-electron atom depend on?
Q: O Use L'Hopital's Rule. x²-25 x-5x²-9x+20 5. lim
Q: What is the ¹H NMR splitting pattern of the indicated hydrogen? H O singlet O triplet
Q: Two objects are maintained at constant temperatures, one hot and one cold. Two identical bars can be…
Q: 9. The following reaction is found to have a [O₂leq= 0.13. What is the equilibrium constant (to four…
Q: 3 Calculator active. Line L is tangent to the graph of y = 2 sin x at the point (k, 2 sin k), where…