Week 1: Memory and the Missing Bug

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12

The fleet's auto-pilot has a bug. Today you learn what 'memory' is, and how it's used to find bugs.

By the end of this week: use a variable to remember a number across two lines of code

For grown-ups: Free preview week.

The story

The R&R fleet’s auto-pilot crashed yesterday. Nobody got hurt; the test landings always happen on safe ground. But the auto-pilot did something weird: it dropped its altitude by 100 feet at exactly the same moment, every test, no matter what was in the way.

The flight engineers think it’s a bug. They want you and your team to find it.

But first, we need to know what memory is.

What’s memory?

Imagine you wrote a number on a sticky note: 42.

You put the sticky note on the fridge. Later, when you want to use the number, you look at the sticky note and read it again: 42.

That’s memory. In code, we call the sticky note a variable, and we give it a name, like altitude.

Try it

altitude = 100
print altitude

Press Run. The console prints 100.

[INTERACTIVE EDITOR]

Now change the first line to altitude = 42. Run it again.

What does the console print now?

Why this matters

The auto-pilot bug is hiding inside a variable that doesn’t get updated when it should. Over the next 12 weeks, you’ll learn to read code, find that variable, and ship the fix.

When you finish

Tap Mark week complete below.

Week 2 →