1, 2, 3, code ! - Cycle 3 activities - Lesson 1.2. How to encode a message with numbers


Students must encode a textual message using only numbers. To do this, they make suggestions and then create a correspondence table for the letters and numbers for use by the entire class. They use this table to encode a message that they send as well as to decode a message they receive.

Key ideas
(see Conceptual scenario)


  • A letter can be represented by a number.
  • A text, which is made up of a series of letters, can be represented by a series of numbers.
  • Encoding of text refers to replacing its letters with corresponding numbers. Decoding is doing the opposite.

Inquiry-based methods



For the classroom


Correspondence table, encoding, decoding


1hour 15 minutes

Scientific notes about the vocabulary before starting

  • In common language, the terms "coding," "encoding," and "encrypting" are often misused or used interchangeably. The term "coding," for example, is sometimes used to mean "programming" (or "writing code"), "representing data" (for example, binary coding), or "modifying a message to make it incomprehensible" (as in a secret "code").
  • Here, we will use these words according to their scientific definitions:
    • Coding means to represent data. During this lesson, students will represent a worded message using numbers. When they convert the letters into numbers, we will talk about encoding, and when they do the operation in reverse, we will talk about decoding. This is the aim of this lesson as well as the next two lessons on binary code.
    • Encrypting a message consists in changing it to make it incomprehensible to any unintended recipients (who do not have the key to decrypt it). This is the aim of Sequence 3.4.
    • The terms enciphering/deciphering (which we will avoid here) are generally used as synonyms for encrypting/decrypting, even more so in the everyday language, but there is a nuance. Cryptanalysis, or decipherment, consists in breaking the cipher of an encrypted message (the key is guessed by someone not meant to have access to it).


Introductory question

The teacher explains to the class that the mission control team communicates with the rover and the astronauts using electronic instruments. These instruments can only send and receive messages in numbers, not letters. Accordingly, the entire worded message to be sent must be converted into a series of numbers before being sent (this is the encoding operation), then converted back into a series of letters when received (this is the decoding operation). There cannot be any spaces or commas between the numbers: the numbers are all "stuck" to each other.

The question is: How can you encode worded messages as numbers and then decode them?


Activity: Encoding and decoding strategy (in pairs)

The teacher tells the students that the astronauts want to extend their outing past the initially stated time. However, the wind has picked up. They need to send a message to mission control with a message that starts with:


When a pair says they have figured out an encoding strategy, the teacher secretly gives each student a slip of paper with a short worded message with a least one space or a period, such as "GO FASTER.", "VERY WELL." or "EVERYTHING IS FINE.". They ask the students to encode the message for their partner, who must then decode it. The teacher reminds the students that the numbers in the encoded message must all be stuck together, without any spaces or punctuation. The two students verify whether the information has been properly transferred. If not, the pair works to identify the problem and change or improve their strategy.

Fifth Grade class, Christelle Crusberg, Champigny-sur-Marne

Teaching notes:

  • The text to encode should contain only letters in ALL CAPS (without any accents), periods and spaces. Accordingly, it is likely that most of the students' solutions will involve linking each letter to a number in alphabetical order (1 = A, 2 = B, etc. up to 26 for Z) with additional numbers to correspond to periods and spaces (e.g., 27 and 28 or 27 and 0).
  • However, some groups may decide to encode using different numbers for uppercase letters (e.g., 1 to 26) and lowercase letters (e.g., 27 to 52). The issue of accented letters and punctuation other than periods may also arise. While the message to encode does not contain any numbers, some groups may try to take this possibility into account. They may decide to link the code numbers 0 to 9 to message numbers 0 to 9, with encoding of letters starting at 10.
  • All of these possibilities should be accepted, even if for simplicity's sake the message given to students will contain only letters and encoding will be identical for all variations of a letter (e.g., A and a are both encoded using 01).
  • Some students may attempt to encode the message by using a less intuitive correspondence between text and numbers, or even create a system that changes on a regular basis (e.g., one that changes every 10 letters). Tell these students to jot their ideas down for a later lesson (Sequence 3.4).


Group discusion

During the group discussion, the teacher asks a first pair of students to tell the class their solution. The other groups' solutions are compared (see Teaching notes above), weighing the pros and cons of each. Next, the class comes to a consensus: a one-to-one correspondence table (without any ambiguity during encoding or decoding) between the letters used in the messages and the numbers.

The correspondence table chosen for the next part of the lesson is the following (note that the actual table used can vary from one class to another, especially with regards to spaces and periods):


Letter A B C D E F G H
Number 01 02 03 04 05 06 07 08
Letter I J K L M N O P
Number  09 10 11 12 13 14 15 16
Letter Q R S T U V W X
Number 17 18 19 20 21 22 23 24
Letter Y Z point Space        
Number 25 26 27 28        

Note that the numbers 1 to 9 (corresponding to letters A to I) were written 01 to 09 so that all numbers used to code the letters are written using the same number of figures (i.e., two). This means that 0221 should be read as 02 21 and decoded as BU; 2201 should be read as 22 01 and decoded as VA. If letters A to I were written using single numbers 1 to 9, a text encoded as 221 could be read as 2 21 or 22 1, which could then be decoded as either BU or VA.


Exercise – Encoding a message (in groups)

The teacher hands out the top of Handout  29 (correspondence table and Instruction 1) and asks the students to encode the message for mission control (Instruction 1) using the correspondence table chosen by the class.

Once the message is encoded, the teacher posts the results and announces that the message was sent to mission control. They emphasize that the original message and the encoded message contain the same information in two different forms.

Discussion with students why it is important to encode the messages using two numbers for each letter.
Fourth Grade class, Carole Vinel, Paris


Challenge – Decoding a message (by groups)

The teacher tells the class that they have just received a reply from mission control in an encoded message. They now need to decode the reply.

The teacher hands out the bottom of Handout  29 (Instruction 2) and gives the students time to decode the message.


The class shares the decoded message:


The mission cannot be extended and the rover must return immediately to base.


Two decoding strategies: each letter one by one (left) or every occurrence of a letter in the text (right).
Fifth Grade class, Anne-Marie Lebrun, Bourg-la-Reine

Teaching note:

The encoding exercise and the decoding challenge can be done collaboratively: have different students encode and decode different lines of the message and then share their answers together with the class. However, we suggest handing out the entire message to students as this facilitates the logistics of the lesson, allows faster students to have work to do and gives students a complete record of what they did together.


Conclusion and lesson recap activity

The class summarizes together what they learned in this lesson:

  • A letter can be represented by a number.
  • A text, which is a series of letters, can be represented by a series of numbers.
  • Encoding of text refers to replacing its letters with corresponding numbers. Decoding is doing the opposite.

Students write down these conclusions in their science notebook. The teacher adds what the class learned about data and algorithms to the "Defining computer science?" poster.


Further study

With older students, the message to decode can be a little longer. For example, the message below is a pangram (all letters of the alphabet are included at least once):




<< Lesson 1.1 Sequence I Lesson 1.3 >>


Project partners

Aucun résultats