← Back to course
1/6
Week 05 · Storing Data

Monday

Answers as codes
// From answers to codes to bits
⏱ about 20 min

Monday: Answers as Codes

The Commons Count sheet is full: 40 rows and six columns. Comet wants to put it on the Commons computer tonight.

"I will type every answer in," she says. "Longer evening hours. Quiet study room. Longer evening hours again."

Wren watches her type the same long words over and over. "What do you notice?"

"My fingers are tired," Comet says. "And I just spelled repair two different ways."

Keeper Ines laughs. "When I log the door count, I just write numbers."

Nova hovers over the keyboard. "Would you like a hint?" she asks. "Give each answer a short number, and write down what each number means."

Comet grabs a fresh sheet. "A list of codes. Let's build it!"

This week's driving question

How do answers become bits, and where should they live?

This week you will build a code book and write codes in binary. Then you will shrink a column and choose where the sheet lives.

The code book

A code book says which number stands for each answer. The crew writes one for Q3.

Some Q3 answers are spelled in messy ways. The crew will clean them next week. Today they decide the codes.

Q3 codeMeans
1longer evening hours
2quiet study room
3repair bench
4bike rack
0blank or invalid

This is the code book from the Commons Count story. The crew also codes Q1 as 1, 2 or 3 for its three choices. Q5 gets 1 for the screen and 2 for a paper form.

USE THE CODE BOOK
  • Read the question.
  • Tap your answer.
M24 answered "repair bench." Which Q3 code does that get?
A row shows Q3 code 4. What did the member ask for?
M18 left Q3 blank. Which code does that get?

Everything becomes bits

Computers store data digitally. That means the smallest parts of any value are bits.

Bit is short for binary digit. A bit is either 0 or 1. A byte is 8 bits.

Bits are grouped to stand for things such as numbers, characters and colors.

The same bits can mean different things in different contexts.

Data values can be stored in variables, lists or constants. How a computer stores data inside is different from how it is shown to people.

SAME CODE, DIFFERENT MEANING
  • Read the question.
  • Tap your answer.
In the Q3 column, what does code 2 mean?
In the Q5 column, what does code 2 mean?
What tells you which meaning a 2 has?
StatementTrue or false?
A bit is either 0 or 1.?
A byte is 8 bits.?
The same bits always mean the same thing, wherever they are.?
A computer may store a code while showing people the words it stands for.?
WHY THIS EXERCISEBits, bytes and context are the base for everything you store this week.
Bit is short for binary ____. Type the missing word.
WHY THIS EXERCISEKnowing where the word bit comes from helps you remember that a bit is one 0 or 1.
BUILD A CODE BOOK
  • ?List every answer a question allows.
  • ?Choose a code for blank or invalid answers.
  • ?Write the code book where everyone can read it.
  • ?Give each answer its own number.
  • ?Use the same code book for every row.
WHY THIS EXERCISEA clear code book lets anyone turn the codes back into answers.

Strong start, data analyst. Tomorrow you will write the codes in binary and find out what happens to code 4.