Python · Session 01

Step 1 of 4
Step 1

Making your program say something

The first thing you'll learn is how to make Python display text. You use print() — a built-in function that outputs whatever is inside the brackets onto the screen.

Text inside print() must be wrapped in quote marks. The quotes tell Python "this is text to display" — not a command or a variable name. Try it below.

hello.py · Saved
Output
Expected output
Hello, world!
Try it yourself
scratch.py · Saved
Step 2

Variables — giving data a name

A variable stores a value so you can use it later. You create one by writing a name, then =, then the value — e.g. name = "Rene". The = means "store this", not "equals".

To print a variable, just write its name directly inside print() — no quotes, no equals sign. So print(name) outputs whatever is stored in name. Try creating two variables below and printing each one.

variables.py · Saved
Output
Expected output
Rene
29
Try it yourself
scratch.py · Saved
Step 3

F-strings — building sentences from variables

Printing variables on separate lines is fine, but often you want to weave them into a sentence. F-strings let you do exactly that. Put f before your opening quote, then place any variable name inside {curly braces} — Python swaps it for the real value at runtime.

So f"My name is {name} and I am {age}." becomes a complete, readable sentence in the output — no matter what the variables hold.

fstrings.py · Saved
Output
Expected output
My name is Rene and I am 29.
Try it yourself
scratch.py · Saved
Step 4

Numbers and simple maths

Variables can hold numbers too — not just text. With number variables you can do arithmetic directly: + adds, - subtracts, * multiplies, / divides. No quotes needed — bare numbers are already numbers.

You can also mix the result into an f-string: f"The total is {price * quantity}" calculates and inserts the answer in one step. Try writing your own calculation and printing the result.

maths.py · Saved
Output
Expected output
Price: 12
Quantity: 4
Total: 48
Write your own
scratch.py · Saved

Session complete

You've learned print(), variables, f-strings, and arithmetic. That's the core vocabulary of Python — and you've used all of it.