Blog › Python

Python for total beginners: your first ten lines

The Questzo team17 November 20262 min read

Python is the language most people learn first, and the one most AI tools are written in. It reads almost like English. Here are ten lines that use the handful of ideas you will meet in every program.

name = "Bitsy"
print("Hello, I am", name)
snacks = 3
print("I have", snacks, "snacks")
if snacks > 2:
    print("That is plenty!")
else:
    print("Time to shop.")
for n in range(1, 4):
    print("Crunch", n)

print: make your program talk

print() shows whatever is inside the brackets. Words go in quotes; numbers and names of variables do not. Commas put a space between the pieces.

Variables: give things a name

name = "Bitsy" stores the text Bitsy under the name name. The equals sign means "store", not "is equal to". Later lines can use the name instead of the value, and if you change the value in one place, every line that uses it changes too.

if and else: make a choice

if snacks > 2: asks a yes-or-no question. The lines pushed in by four spaces underneath only run when the answer is yes. else: is what happens otherwise. Those spaces at the start of the line matter in Python: they tell it which lines belong to the if.

for loops: do it again

for n in range(1, 4): runs the lines under it once for each number from 1 up to (but not including) 4. So it prints Crunch 1, Crunch 2 and Crunch 3. Loops are how a program does a thousand things without a thousand lines.

input: ask the person

One more you will use all the time: answer = input("What is your name? ") waits for the person to type something and stores it. With print, variables, if, loops and input, you can already make a small game.

Three mistakes everyone makes

When Questzo's checks fail, they say which instruction did not pass, and the Ask Pip button explains the error in plain words, including the line it happened on.

Try it

Quest 1, Wake Up starts with a single print(). It runs in your browser, needs no sign-up, and takes about five minutes.

Learn it by building it

Questzo teaches Python by building an AI agent, one pixel quest at a time. The first two chapters are free, with no sign-up.

Start the first quest

Keep reading

AI agents

What is an AI agent? A plain-English guide

A chatbot answers. An agent does things. Here is what makes a program an agent, in plain words and 15 lines of Python.

The Questzo team · 17 November 2026 · 3 min read

Inside Questzo

How the Questzo checks work

Every instruction in a Questzo quest has its own check that runs your real Python. Here is exactly what happens when you press Submit.

The Questzo team · 17 November 2026 · 2 min read

Build

Build a tool-using bot in 30 lines

A step-by-step build: give your bot a calculator and a dice roller, let the model pick the right one, and keep chatting until you say bye.

The Questzo team · 17 November 2026 · 2 min read