Question: Intro to Python: View Insert Cell Kerne Widgets Help TrustedPytha decoded .. ' . Hello trom print('Decoded Message:It', decoded) 15- Creating an Encoder (0.5 points)
View Insert Cell Kerne Widgets Help TrustedPytha decoded .. ' . Hello trom print('Decoded Message:It', decoded) 15- Creating an Encoder (0.5 points) 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, 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: - o Get the unicode code point for the character (using ord) Add the value of key to that code point(which should be an int) o Convert this new int back to a character (using chr). . Also inside the loop, add this converted char to the string encoded 1awritefile A2Code/encoder.py # YOUR CODE HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
