: Start with A at 00000 and increment by one for each letter.
Create a list or dictionary mapping characters to 5-bit strings.
Learning to create your own encoding isn't just about passing a CodeHS quiz. This is the foundation of and Data Compression . By understanding how to map and transform data, you’re learning how the backend of secure messaging apps (like WhatsApp or Signal) works at a very basic level.
: The autograder specifically checks if you used the minimum amount of bits required (5) for the 27 characters.
Copy and paste the encoding function (and, optionally, the decode function for testing) into the code editor. CodeHS usually expects a function named encoding that takes a single string parameter and returns a binary string as shown above. The autograder will test your function with several different inputs, not just “HELLO WORLD,” so make sure your mapping covers all uppercase letters and space.
The objective of this assignment is to create a program that translates a standard string (English) into a secret code (encoded) based on a set of rules you define.
The most critical part of this CodeHS exercise is determining how many bits are needed. If you only encode the and 1 space , you have 27 unique values. 4 bits only provide combinations (not enough). 5 bits provide combinations, which is sufficient for 27 characters.
最常见的做法是按字母顺序分配5位二进制数,最后把空格放在 26 号位置上。
CodeHS is an online platform that provides an interactive and engaging environment for students to learn computer science concepts, including programming, data structures, and algorithms. The platform offers a range of courses, exercises, and challenges that cater to different skill levels, making it an ideal resource for students, teachers, and professionals.
: Start with A at 00000 and increment by one for each letter.
Create a list or dictionary mapping characters to 5-bit strings.
Learning to create your own encoding isn't just about passing a CodeHS quiz. This is the foundation of and Data Compression . By understanding how to map and transform data, you’re learning how the backend of secure messaging apps (like WhatsApp or Signal) works at a very basic level.
: The autograder specifically checks if you used the minimum amount of bits required (5) for the 27 characters.
Copy and paste the encoding function (and, optionally, the decode function for testing) into the code editor. CodeHS usually expects a function named encoding that takes a single string parameter and returns a binary string as shown above. The autograder will test your function with several different inputs, not just “HELLO WORLD,” so make sure your mapping covers all uppercase letters and space.
The objective of this assignment is to create a program that translates a standard string (English) into a secret code (encoded) based on a set of rules you define.
The most critical part of this CodeHS exercise is determining how many bits are needed. If you only encode the and 1 space , you have 27 unique values. 4 bits only provide combinations (not enough). 5 bits provide combinations, which is sufficient for 27 characters.
最常见的做法是按字母顺序分配5位二进制数,最后把空格放在 26 号位置上。
CodeHS is an online platform that provides an interactive and engaging environment for students to learn computer science concepts, including programming, data structures, and algorithms. The platform offers a range of courses, exercises, and challenges that cater to different skill levels, making it an ideal resource for students, teachers, and professionals.