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, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 3
question
Computers and Technology, 23.06.2019 15:30
Hey so i was just trying out some game hacks so i took a paste from online and built it in my visual studio and then suddenly my computer was working or clicking on stuff on its own am i hacked?
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
question
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
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, 27.01.2022 20:30
question
English, 27.01.2022 20:30
question
Mathematics, 27.01.2022 20:30
Questions on the website: 13722359