Write a program that encrypts a given message as specified in the following tasks Task 1:...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that encrypts a given message as specified in the following tasks Task 1: Write a function named encrypt which admits two parameters: a string message that is to be encoded and an integer key. You can assume that the arguments given to the function will be alphabetic strings and will not contain any special characters or numbers. Convert all characters in the string to uppercase Convert each character in the string to its ASCII value and add the key to it Convert the resultant number from adding the key to its string encoding Concatenate all the values to form the encoded string Return the concatenated string Write a program that encrypts a given message as specified in the following tasks Task 1: Write a function named encrypt which admits two parameters: a string message that is to be encoded and an integer key. You can assume that the arguments given to the function will be alphabetic strings and will not contain any special characters or numbers. Convert all characters in the string to uppercase Convert each character in the string to its ASCII value and add the key to it Convert the resultant number from adding the key to its string encoding Concatenate all the values to form the encoded string Return the concatenated string
Expert Answer:
Answer rating: 100% (QA)
Solution Here is the Python code for encrypting a message def encryptmessage key Encrypts a message using a given key Args message The message to encrypt key The encryption key Returns The encrypted m... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
u(x, y) = x +y. a)Prove the ratio amount of good x to y is py/px. (Tangency condition) b) Consider the preferences represented by u(x, y) = max {x, y}.Illustrate some representitive indifference...
-
In this project, we will write a program that controls a quiz show, much like the many popular TV shows. The program will read in a group of questions and their multiple choice answers, storing them...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
In Exercises 6780, begin by graphing the square root function, f(x) = x. Then use transformations of this graph to graph the given function. h(x)=x + 2-2
-
Block A supports a pipe column and rests as shown on wedge B. Knowing that the coefficient of static friction at all surfaces of contact is 0.25 and that = 45, determine the smallest force P for...
-
On January 23, 15,000 shares of Aurora Company's common stock are acquired at a price of $25 per share plus a $150 brokerage commission. On April 12, a $0.50-per-share dividend was received on the...
-
Table B. 15 presents data on air pollution and mortality. Use the all-possibleregressions selection on the air pollution data to find appropriate models for these data. Perform a thorough analysis of...
-
Greener Grass Fertilizer Company plans to sell 200,000 units of finished product in July and anticipates a growth rate in sales of 5 percent per month. The desired monthly ending inventory in units...
-
Suppose the intrinsic futures price is GREATER than market futures price. As a speculator, should you buy or sell futures contract? Explain
-
Niagara Dairy is a boutique cheese maker based in the Niagara region of Ontario. Over the years, the business has grown by supplying local retailers and, eventually, by exporting cheese products. In...
-
1. Prepare an income statement for 20Y3. Create a separate statement indicating the division of net income to the partners. The partnership agreement provides for salary allowances of $45,000 to...
-
the first 8 units have now been produced. the first unit took 2 0 0 hours to make and the total time for the first 8 units was 8 1 9 . 2 . What was the actual rate of learning which occured?
-
AliMama Company has a semi-annual coupon discount bond which pays a 7% coupon. The bond has a YTM of 9%, and has thirteen years to maturity. a) If interest rates and YTM remain unchanged, calculate...
-
The bank loan schedule for financing the new office requires $1,600 payment at the beginning of each month for 2 years, starting in 18 months later. However, interest on the bank loan still charges...
-
You pay $32,000 today (t=0) and obtain (purchase) a 9 percent annuity (r=0.09) with 24 annual payments (you will receive 24 payments). The first payment on the annuity is made in two years (t = 2)....
-
A farmer used to sell a carton of eggs for $2.50 each. At this price, the farmer used to sell an average of 2,500 cartons of eggs per month. When the farmer raised the price to $3.20, sales dropped...
-
The budgeting process does not involve which ofthe following activities? a. Execution of plans to achieve goals. b. Specific goals are established. c. Periodic comparison of actual results to goals....
-
For the next several days, take notes on your listening performance during at least a half-dozen situations in class, during social activities, and at work, if applicable. Referring to the traits of...
-
Overload the method selectionSort in Listing 7.10 so that it sorts an array whose indices range from first to last, where 0 first last, and last is less than the length of the array. Listing 7.10...
-
Practice Program 5.4 asked you to define a Trivia class that contained strings representing a trivia question and answer to that question. Add an integer for the number of points that the question is...
-
Sometimes we would like a class that has just a single unique instance. Create a class Merlin that has one attribute, theWizard, which is static and of type Merlin. The class has only one constructor...
-
What minimum information must be extracted from a video clip of a moving object in order to quantify the object's motion?
-
Figure P2.4 shows a graph of position versus frame number from a video clip of a moving object. Describe this motion from beginning to end, and state any assumptions you make. Data from Figure P2.4...
-
The sequence in Figure P2.2 represents a ball rolling into a wall and bouncing off of it. The ball is \(10 \mathrm{~mm}\) in diameter. Make a graph showing the distance from the leading edge of the...
Study smarter with the SolutionInn App