8.3 8: Create Your Own Encoding Codehs Answers
Fix: Build fresh dictionaries inside functions or pass them as parameters.
Fix: Test decode(encode("Test")) == "Test" after every change. 8.3 8 create your own encoding codehs answers
Plaintext: "CS IS FUN."
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
def encode_custom(msg):
return [alphabet.index(ch.upper()) for ch in msg if ch in alphabet]
Note: This loses case information and only works for letters+space. Fix: Build fresh dictionaries inside functions or pass