Menu

[Solved]Q16 Decoder 05 Points Write Code Block Decode Strings Secret Encodings Back Readable Messa Q37129448

Q16-Decoder (0.5 points) Write a code block to decode strings from secret encodings back to readable messages. To do so: Init

Q16-Decoder (0.5 points) Write a code block to decode strings from secret encodings back to readable messages. To do so: Initialize a variable called decoded as an empty string . Use a for loop to loop across all characters of a presumed string variable called encoded Inside the loop, convert the character to another character o Get the unicode code point for the character (using ord o Subtract the value of key to that code point (which should be an int) o This undoes the secret encoding of the character, getting back to the original value Convert this new int back to a character (using chr). Also inside the loop, add this converted char to the string decoded Note that the code to answer this question should look very similar to how you answered the encoding question. In fact, you can even copy over the encoding code, and make some small changes to make it function as a decoder. In [ ]: %%writefile A2Code/decoder.py #YOUR CODE HERE raise NotImplementedErrorO In [87]: key 200 encoded-Iij3k %run -i ./A2Code/decoder.py assert isinstance(decoded, str) assert decodedhello” print( Encoded Message: t, encoded) print( Decoded Message: It’, decoded) Show transcribed image text Q16-Decoder (0.5 points) Write a code block to decode strings from secret encodings back to readable messages. To do so: Initialize a variable called decoded as an empty string . Use a for loop to loop across all characters of a presumed string variable called encoded Inside the loop, convert the character to another character o Get the unicode code point for the character (using ord o Subtract the value of key to that code point (which should be an int) o This undoes the secret encoding of the character, getting back to the original value Convert this new int back to a character (using chr). Also inside the loop, add this converted char to the string decoded Note that the code to answer this question should look very similar to how you answered the encoding question. In fact, you can even copy over the encoding code, and make some small changes to make it function as a decoder. In [ ]: %%writefile A2Code/decoder.py #YOUR CODE HERE raise NotImplementedErrorO In [87]: key 200 encoded-Iij3k %run -i ./A2Code/decoder.py assert isinstance(decoded, str) assert decodedhello” print( Encoded Message: t, encoded) print( Decoded Message: It’, decoded)

Expert Answer


Answer to Q16-Decoder (0.5 points) Write a code block to decode strings from secret encodings back to readable messages. To do so:… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *