subject

Write a code block to encode strings into a secret message. Your code will presume a number, stored in key, and a message to encode, stored as a string variable called message. Don't define these variables in your code - they will be defined when you run the tests.
To do so:
Initialize a variable called encoded as an empty string
Use a for loop to loop across all characters of a string variable message
Inside the loop, convert the character to another character:
. Get the unicode code point for the character (using ord)
. Add the value of key to that code point (which should be an int)
. Convert this new int back to a character (using chr).
Also inside the loop, add this converted char to the string encoded
Note: You should not define key or message in your answer. Those are defined in the cell below where your code is executed (where you see %run)
In [ ] : %%writefile A2Code/encoder. py
# YOUR CODE HERE
raise NotImplementedError()
In : key -200
message-hello
%run -i . /A2Code/encoder .py
assert isinstance(encoded, str)
assert encodedij5k
print( Original Message: It', message)
print( Encoded Message: t', encoded)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
question
Computers and Technology, 23.06.2019 22:40
22. sata3 allows for data transfer rates of 600 mb/s. explain why you would likely not be able to copy data from one hard drive to another at anywhere close to this speed. also, what could be upgraded on the computer to achieve transfer speeds closer to 600 mb/s
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Two students are discussing the flow of electricity. student a says that voltage is a measure of the amount of electron flow in a circuit. student b says that power is the product of voltage and current. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Which type of cloud computing offers easily accessible software and applications on the machines
Answers: 1
You know the right answer?
Write a code block to encode strings into a secret message. Your code will presume a number, store...
Questions
question
Mathematics, 31.10.2020 08:40
question
Mathematics, 31.10.2020 08:50
question
English, 31.10.2020 08:50
Questions on the website: 13722367