Skip to content
Back to course

1. Your first Python program

Welcome to Coding for Beginners: Python! You do not need any experience. In this first lesson you will learn what a program is, write the famous "Hello, World!" line, and understand the basics of running Python code. By the end you will have written real code — and that is worth celebrating!

A program is a set of instructions you give to a computer. Just like you might write a recipe for injera — "mix teff flour, add water, ferment for two days, then bake" — a computer program is a recipe the computer follows step by step.

Python is one of the most popular programming languages in the world. It is used by companies, scientists, and beginners alike because its instructions look almost like plain English. If Abebe can read a recipe, Abebe can learn Python.

Every programmer's journey begins with the same program — it tells the computer to display a message on screen. Here is what that looks like in Python:

print("Hello, World!")

When you run this one line, the computer shows:

Hello, World!

That is it. You just wrote a Python program. The word print is a built-in Python command that means "show this text on screen". The text you want to show goes inside the parentheses, surrounded by quotation marks.

Python accepts both single quotes ('Hello') and double quotes ("Hello") around text. Either works — just be consistent: open and close with the same type. Forgetting a closing quote is one of the most common beginner mistakes, so always double-check.

Where do you actually write and run Python? You have three easy options:

1. Online (no installation needed) — visit python.org/shell or replit.com in any web browser. Type your code and press Run. This is the fastest way to start.

2. IDLE — a simple editor that comes bundled with Python when you install it on your computer (free download at python.org).

3. VS Code — a popular, free editor used by professional developers. Once Python is installed, VS Code makes it easy to run your files.

For this course, the online option is perfect. Sara, who runs a small electronics shop in Merkato, started learning Python on her phone's browser during slow hours — no laptop needed.

You are not limited to "Hello, World!". You can print any text you like:

print("Selam, Addis Ababa!")

print("My name is Almaz.")

print("1 birr = 100 santim")

Each print() call displays one line. If you write three print() calls one after another, you get three lines of output. Try changing the message to your own name or city!

Notice that numbers inside quotation marks are treated as text. If you write print("100"), Python shows the characters 1, 0, 0 — it does not do any maths. You will learn how to work with actual numbers in the next lesson.

Python lets you add notes inside your code using the # symbol. Anything on a line after # is called a comment — Python ignores it completely. Comments are for humans, not the computer.

# This program greets the user

print("Selam, Abebe!") # prints a friendly greeting

Comments are your way of explaining what your code does. When you come back to code you wrote a month ago — or when a colleague reads your code — comments save everyone time. Good programmers write comments often.

Scenario

Dawit wrote this Python code and ran it, but he got an error. What is the most likely reason? print("Welcome to TeleBirr!)

Lesson recap: • A program is a set of step-by-step instructions for a computer. • Python is a beginner-friendly language whose code looks close to plain English. • print("...") displays text on screen — it is your most-used tool as a beginner. • Use matching quotation marks (single or double) around your text. • You can run Python free online at python.org/shell or replit.com — no installation needed. • Use # to write comments that explain your code to yourself and others. • Error messages are helpful — read them to find and fix mistakes.

Check your understanding

1/7 · 77 XP

Which of the following correctly prints a message in Python?