Reference no: EM132171843
Using Python, create a program that begins by prompting the user for an input file (which contains the message), 5 shift amounts (all integers), and whether they would like to encrypt or decrypt, then our implementation will add some variation to the basic algorithm to make it a little harder to decode. When encrypting:
(1) We will read the text data from the file line-by-line, and all of the transformations described below be should applied line-by-line. Before doing the transformations below you should use strip() to remove the whitespace at the ends of a line.
(2) Replace each "e" character in the original message with the letters "zw". If the file contains "Hello World!", the resulting message will be "Hzwllo World!".
(3) After replacing the "e" characters, you'll add the word "hokie" to the beginning, middle (the middle is length//2), and the end of the message. Continuing with example above the message that's actually encrypted using the Caesar Cipher is "hokieHzwllohokie World!hokie". This should be done for each line in the file.
Once you have the altered message then we will perform a slightly modified Caesar Cipher encoding as described below and print the result. Like above this transformation is applied line- by-line and shouldn't "cross" lines.
Rather than have a single shift, instead we will have 5 shift amounts entered by the user. The shifts are applied character by character. So if the user enters shift amounts: 3 4 5 6 7 and the first line of the file contains "Hello World!", your program will first transform it into "hokieHzwllohokie World!hokie" then:
"h" would be shifted by 3 characters. "o" would be shifted by 4 characters. "k" would be shifted by 5 characters. "i" would be shifted by 6 characters. "e" would be shift by 7 characters.
We then start back at the first shift amount:
"H" would be shifted by 3 characters. "z" would be shifted by 4 characters. "w" would be shifted by 5 characters. "l" would be shifted by 6 characters. "l" would be shift by 7 characters.
The space, exclamation point, and anything else that's not a letter isn't shifted, but it does "take up" a shift amount. So if the space character would have been shifted by 3 characters, the next character would be shifted by 4. This continues until the end of the line is reached. The whole process starts over with shift amount 3 on the next line in the file.
When decrypting, perform each step in reverse order. Decrypt the message using the Caesar Cipher above, then remove the "hokie" strings, then change any occurrence of "zw" to "e". You may assume the all occurrences of "zw" in the result are really "e" characters, and further you may assume the "hokie" strings are in the encrypted message at the appropriate place, however there may be other occurrences of "hokie" in the original message.
Finally, your program must be able to encrypt/decrypt an arbitrary number of messages. When you've completed the encrypting/decrypting a message the user should be asked if they want to enter another message. Your program should continue until the user types "N".
|
Write a program that plays a modified yahtzee game
: You will allow a single player to play with 5 dice. For those of you who know how to play the game, you will only play the top half of the game.
|
|
Net income is reported on the income statement
: Net income is reported on the Income Statement, an accounting equation that follows GAAP, generally accepted accounting principles
|
|
Create a program that analyzes a text file and produces
: Any sequence of alphanumeric characters (length >= 1) with the beginning and ending non-alphanumeric character removed counts as a word.
|
|
What is the net present value of seattle corporation
: Seattle Corporation identifies an investment opportunity that will yield end of year cash flows of $30,000 in both Year 1 and Year 2
|
|
Create a program that begins by prompting the user
: Create a program that begins by prompting the user for an input file (which contains the message), 5 shift amounts (all integers).
|
|
What is cabbor cost of equity capital
: What is Cabbor's cost of equity capital (that is, compute the required rate of return on the stock)?
|
|
Space between the minus sign and the number
: Consider a Zerobond (i.e., a bond that pays no coupon payment, meaning that the coupon rate on the bond is 0%) with a par value of $1,000 that will mature
|
|
Par value bond with a coupon rate
: Compute the yield to maturity of a $1,500 par value bond with a coupon rate of 7.5% (quarterly payments - that is, four times per year) that matures in 25 years
|
|
How do organizations measure risk
: Identify the major business and financial risks such as interest rate risk, foreign exchange risk, credit, commodity, and operational risks
|