8.3 8 Create Your Own Encoding Codehs Answers Jun 2026

Strings do not have .append() . Use += or build a list and join() .

def decode(encoded_str): decoded = "" for ch in encoded_str: if ch == '1': decoded += 'a' elif ch == '2': decoded += 'e' elif ch == '3': decoded += 'i' elif ch == '4': decoded += 'o' elif ch == '5': decoded += 'u' else: decoded += ch # Reverse back to original order return decoded[::-1] 8.3 8 create your own encoding codehs answers

in the CodeHS IDE to see expected behavior. Strings do not have

In the CodeHS exercise 8.3.8: Create Your Own Encoding , the goal is to build a simple encryption program. You aren’t just following a pattern; you are defining how one character transforms into another using a How it Works The program typically requires you to: Define a Key: In the CodeHS exercise 8

def encode(message, encoding): result = "" for char in message: if char in encoding: result += encoding[char] else: result += char return result

Computers see 'A' and 'a' as different things. Use .lower() on your input to make sure your encoding handles both the same way.

def encode(message, encoding): return ''.join(encoding.get(c, c) for c in message)