>>> Python for Beginners Chapter 01 of 10

Chapter 01 ยท Getting Started

Your First Program

Every programmer's journey starts with making the computer say one thing. In the next five minutes you will write and run real Python โ€” no installing anything.

๐Ÿ—ฃ๏ธ
Real-world analogy

Programming is just giving a very literal assistant a list of instructions. The assistant does exactly what you write โ€” no more, no less. Our first instruction is the simplest one: "say this out loud." In Python, saying something out loud is called printing.

The easiest way to run Python: our playground

You don't need to install anything to start. Open our free code playground in a new tab, choose Python at the top, type your code, and press Run. That's your whole workshop for this course. (Later you can install Python properly, but there's no rush.)

Your first line

Type this into the playground and press Run:

print("Hello, world!")
Hello, world!

Congratulations โ€” you just wrote a program. Let's break down that one line:

Printing more than once

Each print starts a new line, so a program runs top to bottom like a recipe:

print("My name is Godfrey.")
print("I am learning Python.")
print("This is fun!")
My name is Godfrey. I am learning Python. This is fun!

Comments โ€” notes to yourself

Anything after a # is a comment: Python ignores it completely. Comments are notes for humans reading the code.

# This line is just a note - Python skips it
print("Only this line runs.")
Only this line runs.
โœ๏ธ Try it yourself

In the playground, print three lines: your name, your town, and one thing you want to build one day. Change the words and run it again โ€” breaking things and fixing them is exactly how you learn.

Common first mistake

Forgetting the quotes. print(Hello) makes Python look for something named Hello and fail. print("Hello") prints the text. Quotes = "this is literally text."

Recap