Create Performance Task-Practice-1
Create Performance Task-Practice-1
VIDEO: https://somup.com/cTeebD7Fbh
1. Describe the overall purpose of the program. This program is designed to
allow people to communicate in a secretive manner. This allows users to
exchange information discreetly and protectively. Only someone with access to
the same algorithm and key list can decode the message, making it a simple
yet effective tool for protecting messages and communication.
3. Describe the input and output of the program demonstrated in the video.
The input of this program has two parts: first is the message and second is
whether the user wants it to be encrypted or decrypted by entering either ‘e’
or ‘d’. If the user chooses ‘e’ for encryption, the program outputs a scrambled
version of the original message using the key. If ‘d’ for decryption is inputted,
the program outputs the original message by reversing the process. If the user
inputted an invalid input, then the program outputs the error and prompts
them to enter a valid input ensuring the program runs.
4. Which part of the program code shows how the data has been stored in
the list. Paste Screenshot
5. Place a screenshot of the program code segment that shows the data in
the same list being used, such as creating new data from existing data or
accessing multiple elements in the list, as part of fulfilling the program’s
purpose.
scramble_message
8. Describe what the data contained in the list represents in your program.
The data in the list represents a sequence of numerical values that are the key
for scrambling and unscrambling the message within the program. Each
number is used to determine how much the corresponding character should be
shifted, repeating them as necessary for longer messages. Even and odd
values are handled differently, adding security to the code. The list acts as a
customizable key for unique patterns of character changes, making it essential
for encryption.
9. Explain how the selected list manages complexity in your program code
by explaining why your program code could not be written, or how it
would be written differently if you did not use the list.
The list manages the ability for the code to scramble the message because it
provides the key to follow when altering the message. It serves as a
reusable and organized collection of values that guides the scrambling
process. If you were to not use the list, it would be very difficult for the
code to fulfill its functionality because there would be no key to follow,
unless if you were to manually specify each character encrypted. This
would make it much longer, harder to read and nearly impossible to scale.
1. Create a key list: define a list of integers called keylist. This list contains a
repeating pattern of numbers.
2. Prompt for a message: ask the user to enter the message they want to
encrypt
5. Iterate through the message using a for loop and the keylist to find the
corresponding key using the modulus operation to make sure the keylist
loops if the message is longer than the list.
6. Check if the key is even: convert the character to its Unicode value and add
the key. Use modulo 256 to keep the result within the valid character
range and convert it back to a character.
7. If the key is odd, add the key plus two and repeat the process in step 6.
11. Describe two calls to the procedure identified in #4 and #5. Each call
must pass a different argument(s) that causes a different segment of
code in the algorithm to execute. (It would help if you ran the code in
codhs)
Test 1: scramble_message(“hello”)
Test 2: scramble_message(“hi”)
2nd Result: hj