: Match the exact text requested by the prompt (e.g., if the assignment says "Enter text: ", do not use "Enter a message to encode: ").
The function initializes encoded_result = "" . This is known as the . Because strings in Python are immutable (they cannot be changed in place), we must build a brand-new string piece by piece as we loop through the input. 2. The for Loop
Depending on whether you are completing CodeHS in or JavaScript , your implementation will utilize different syntax, but the underlying logic remains identical. The JavaScript Approach
At its heart, an encoding is a system of rules. It’s a dictionary that defines how to represent a piece of data as something else. In computer science, we most often talk about —how text characters (graphemes) are translated into the binary (1s and 0s) that computers can process. The most common standard is ASCII, where, for example, the letter 'A' is represented as the decimal number 65, which in binary is '01000001' .