Skip to content

Chapter 1: Your First Program

Every app, website, and game starts with code. In this chapter, you’ll learn what code really is — and write your very first program!

A program program: A set of instructions written in a language that a computer can understand and follow. is a set of step-by-step instructions for a computer. Just like a recipe tells you how to bake a cake, a program tells a computer how to do something.

Here’s your very first Python program:

print("Hello, world!")

When a computer runs this code, it prints the words Hello, world! on the screen. That’s it — you just read your first program!

Let’s look at each part:

PartWhat It Does
print()Tells the computer to display something on the screen
"Hello, world!"The string string: A piece of text in a program, always surrounded by quotation marks. (text) you want to display

Here are some things to try. Change the text inside the quotes and see what happens!

print("My name is ___!")
print("I am ___ years old.")
print("My favorite subject is ___.")

A variable variable: A named container that stores a value, like a labeled box that holds something inside. is like a labeled box where you can store information:

name = "Alex"
age = 10
print("Hi, my name is " + name)
print("I am " + str(age) + " years old")

You can change what’s inside a variable at any time — that’s why it’s called a variable!


  1. What does the print() function do?
  2. Why do we put quotes around text in Python?
  3. If you wrote greeting = "Hey there!", what would print(greeting) show on the screen?