CODING
ADVENTURE
0 / 12 completed

CASE 01 / CHAPTER 1

Your first message

Instructions, strings and variables

IN THE STORY

Tony asks Dustin to make a computer greet a visitor to the repair shop.

The idea

A program is a sequence of instructions. Python runs these lines from top to bottom. Text inside quotation marks is a string. A variable gives a value a name: the equals sign stores the value on the right under the name on the left. print displays a result. With strings, + joins pieces of text. For example, print("Hi, " + "Tony") displays Hi, Tony.

Your mission

Finish the message expression so the program welcomes Christine. Keep the comma, space and exclamation mark.

Replace ____ with the missing expression, then choose Run code. Match the expected output before trying your own changes.

Before you run it

What changes if name becomes "Dustin"? What stays the same?

A little help?

Hint 1: a nudge

Use the variable name without quotation marks to get its value.

Hint 2: a closer look

Join "Ready, ", name and "!" with +.

How the answer works

The program prints Ready, Christine! A quoted "name" would print the word name, rather than the value stored in the variable.

This replaces the code in the editor. Save your version first if you want to keep it.

Make it yours

Change the name and predict the output before running it again. Use your first name or an invented name.

first_program.pyPYTHON 3

Four spaces indent a block. Ctrl / ⌘ + Enter runs your code. Tab moves to the next control.

OUTPUTPython loads when you run
Your program's output will appear here.

Take a guess. Try a line. See what happens.

Expected output

Ready, Christine!

Code runs on your device. The first run downloads the Python engine (about 10 MB); later runs use the browser cache. Stop ends a run without losing your code.