Set the "Bits in Encoding" to 5 to accommodate the mapping above.
In Python, you use ord() to get the ASCII number of a letter and chr() to convert it back.
: Ensure your loop visits every index from 0 to length - 1 . 83 8 create your own encoding codehs answers
return output;
for char in text: # Convert character to ASCII number and add 5 new_num = ord(char) + 5 # Convert back to character new_char = chr(new_num) # Add to result result += new_char Set the "Bits in Encoding" to 5 to
user_message = "Hello World" encoded = encode_message(user_message) decoded = decode_message(encoded)
Decide which characters to encode (e.g., a-z , A-Z , 0-9 , punctuation). 83 8 create your own encoding codehs answers
You must use the fewest number of bits possible to represent all characters.