fuckingpython.lol

Learn Python › Lesson 1

Python hello world: your first fucking program

Updated · every example run on Python 3.9 to 3.15

Every programmer's first program prints a greeting. It is a cliché because it works: if this one line runs, your Python is installed, your editor saves files where you think it does, and your terminal can find the interpreter. Each of those three will, at some point, ruin an afternoon of yours. Better to meet them now, while the stakes are one line long.

Do you already have Python?

Open a terminal (Terminal on a Mac, PowerShell on Windows) and ask it. On Windows the command is py --version; everywhere else:

python3 --version
Python 3.15 prints
Python 3.15.1
PythonPrints
3.9Python 3.9.6
3.10Python 3.10.22
3.11Python 3.11.17
3.12Python 3.12.15
3.13Python 3.13.17
3.14Python 3.14.9
3.15Python 3.15.1

Run on CPython 3.9.6, 3.10.22, 3.11.17, 3.12.15, 3.13.17, 3.14.9 and 3.15.1, on November 11, 2026.

If you get a version number back, you have Python. Which one depends on what your machine shipped with and what you installed since. This site runs every example on all seven of these, and the table shows what each one answers.

If the terminal says command not found

Then there is no Python on your path, or there is one and it is called something else. On a Mac or Linux try python3 before python: plenty of systems never had a plain python at all, which is exactly the error the page zsh: command not found: python is about.

To install one, get the installer from python.org, or on a Mac with Homebrew run brew install python. Anything from 3.10 up is fine for this course; the newest is better, because its error messages are the least cryptic.

Write the program

Make a folder for the course, open it in an editor (any editor: VS Code, PyCharm, even Notepad will do), and create a file called main.py with one line in it:

main.py
print("Hello, world!")

Save it, and in the terminal, from that folder, run:

python3 main.py
Python 3.9 to 3.15 all print
Hello, world!

That's it. That's programming. Everything after this lesson is the same move with more lines: write instructions in a file, hand the file to python3, read what comes back.

What print actually does

print writes whatever you give it to the terminal and ends with a new line. Give it several things, separated by commas, and it puts a space between them. Text goes in quotes; numbers don't. A # starts a comment, which Python skips: it is for the humans, including you in three weeks.

main.py
# Python ignores this line. Write notes here.
print("Hello", "world", 42)
print("one", "two", "three", sep=" -> ")
print("no new line after this", end="")
print(" ...so this lands on the same line")
Python 3.9 to 3.15 all print
Hello world 42
one -> two -> three
no new line after this ...so this lands on the same line

sep is what goes between the items, end is what goes after the last one. Both have defaults (a space and a new line), which is why you rarely type them.

Break it on purpose

Programs fail, and the error message is the most useful thing Python will ever say to you. Leave off the closing parenthesis and see how it complains:

main.py
print("Hello, world!"
Python 3.15 prints
  File "/home/me/project/main.py", line 1
    print("Hello, world!"
         ^
SyntaxError: '(' was never closed
PythonPrints
3.9SyntaxError: unexpected EOF while parsing
3.10–3.15SyntaxError: '(' was never closed

Run on CPython 3.9.6, 3.10.22, 3.11.17, 3.12.15, 3.13.17, 3.14.9 and 3.15.1, on November 11, 2026.

Python 3.9 shrugs that the file ended too soon. From 3.10 on it points at the exact parenthesis you forgot to close. That gap is why this course prefers a new Python: the older the interpreter, the vaguer the insult. When you meet an error you can't read, look it up on this site's list of Python error messages.

Try it yourself

Print your name and the year on one line, joined by a slash, so the output looks like Ada/2026. Use one print and the sep argument.

Show the answer
print("Ada", 2026, sep="/")

The number needs no quotes; print turns it into text for you.

Questions

Should I type python or python3?

On a Mac and on Linux, python3: it exists everywhere a Python 3 is installed, while plain python may be missing or, on old systems, may even be Python 2. On Windows, py.

Do I need to learn Python 2 first?

No. Python 2 reached its end of life on January 1, 2020 and gets no fixes, not even security ones. Everything here is Python 3.

Which editor should I use?

Any editor that saves plain text. VS Code with its Python extension is a common free choice, and it can run the file for you. The editor matters much less than learning to read what the terminal tells you.

Sources

Read on November 11, 2026.