Topic 0.3
Python Versions and the Version Tags in This Course
In one line
Python gets a new version every October, and each version is supported for about five years. This course runs Python 3.13 in your browser and marks every newer feature with a badge such as Python 3.10+, so you always know which Python a piece of code needs.
Think of it like this
Phone software. Your phone gets a big update about once a year, with new features, and older phones stop getting updates after some years. An app that needs the newest features will not install on an old phone. Python works the same way: a new version each year, a few years of support, and code that uses a new feature needs a new enough Python.
Words you'll meet
New words in this topic, in plain English. Come back here whenever one feels fuzzy.
- Version
- A numbered release of Python, such as 3.13. Higher numbers are newer.
- Minor version
- The second number (the 13 in 3.13). A new one arrives each October and adds features.
- Micro version
- The third number (the 2 in 3.13.2). It only fixes bugs and security problems.
- Release
- The moment a version is published for everyone to download.
- End of life (EOL)
- The date after which a version gets no more fixes at all. Don't run EOL versions for real work.
- Backward compatible
- New versions still run old code. Python 3 minor versions are almost always backward compatible with earlier Python 3 code.
- Deprecated
- Still works, but officially discouraged and due to be removed in a future version.
- PEP
- Python Enhancement Proposal: a public numbered document that proposes a change to Python.
- SyntaxError
- The message Python prints when the grammar of your code is broken. Topic 0.7 explains error messages.
Step by step
01Read a version number
Take 3.13.2. Major 3: the Python 3 language. Minor 13: the thirteenth feature release after 3.0. Micro 2: the second round of fixes for 3.13.
Two Pythons with the same major and minor numbers (3.13.1 and 3.13.2) run the same code. Two with different minor numbers (3.9 and 3.13) may not: code written for 3.13 can use features that 3.9 has never heard of.
02Ask Python which version it is
In a terminal, python --version prints the version. On macOS and Linux the command is usually python3; Topic 0.4 explains why.
Inside a program, the sys library knows the version. import sys loads that library (Phase 6 teaches import), and sys.version_info holds the version numbers separately so code can compare them.
import sys
print("Major version:", sys.version_info.major)
print("Minor version:", sys.version_info.minor)03The yearly rhythm
Since 2019 Python has followed a fixed calendar: one minor version every October. After release, a version gets regular fix releases for about two years, then security-only fixes until its fifth birthday.
So at any moment about five versions are alive. In October 2026 those are 3.11 to 3.15, and 3.10 has just reached end of life.
04What new versions add
Each version adds a few things you will meet in this course. 3.8: the walrus operator :=. 3.9: list[int] type hints and | to merge dictionaries. 3.10: the match statement and much better error messages. 3.11: faster execution, exception groups and tomllib. 3.12: cleaner syntax for generic types and more flexible f-strings. 3.13: a new coloured interactive shell. 3.14: template strings and an officially supported build without the global interpreter lock (the rule that lets only one thread run Python code at a time; Phase 13).
Every name in this list is something a later phase teaches. Here the list only shows that each version brings new things. You don't need to memorise it. The badges in each lesson tell you when a version matters.
05New code on an old Python fails
The match statement arrived in 3.10. Run a file that uses it on Python 3.9 and you get a SyntaxError before a single line runs, because 3.9's grammar has no match.
When code that "works for everyone else" gives you a SyntaxError on a line that looks fine, check your Python version first.
command = "start"
match command: # needs Python 3.10 or newer
case "start":
print("Starting")
case "stop":
print("Stopping")06How this course marks versions
Next to a topic title or an example you will sometimes see a badge like Python 3.10+. It means the feature needs that version or newer. No badge means the code works on every Python you are likely to meet.
Runnable examples always work on Python 3.13, because that is what your browser runs. Features newer than 3.13 appear as read-only code with a badge and a note.
Try it yourself
- 1
Find the version on this page
Run the first example. Then change
(3, 10)to(3, 14)and predict which of the two messages prints before you run it again. - 2
Fix the Python 2 line
In the third example, change the last line to
print('hello')and run it. Now all four lines run. Look at the first two lines of output:/gives3.5and//gives3. In Python 2,7 / 2gave3, one of the changes Python 3 made on purpose. - 3
Check your own computer
If Python is already installed on your computer, open a terminal and type
python --version(orpython3 --version). If it is not installed, Topic 0.4 is next.terminal$ python3 --version── expected output ──Python 3.14.0
Code & diagrams
On this page the answer is 3.13. Run the same file on your own computer later and the numbers will be whatever you installed. `(3, 10)` is a pair of numbers in round brackets: Python compares the first numbers, then the second. `if` and `else` choose between two paths (Phase 2).
Expected output
Major version: 3
Minor version: 13
Short form: (3, 13)
This Python has the match statement.The badge says this needs Python 3.10 or newer. Change command to "stop" and run again. Topic 2.8 teaches match properly.
Expected output
StartingThe last line is Python 2 style. Python 3 refuses the whole file and even tells you the fix. Add the brackets to make it run.
Expected output
File "main.py", line 4
print 'hello'
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?Version Released Some of what it added
3.10 October 2021 match statement, clearer error messages
3.11 October 2022 faster execution, exception groups, tomllib
3.12 October 2023 new syntax for generic types, more flexible f-strings
3.13 October 2024 new interactive shell (this course's Run button)
3.14 October 2025 template strings, supported free-threaded build
3.15 October 2026 UTF-8 as the default text encoding, lazy importsBreak it on purpose
Errors are the best teachers. Make each change, read the error, guess what went wrong, then reveal the answer.
Break #1
Use Python 2 print
Write print 'hello' without brackets, as old tutorials show, and run it.
print 'hello'Break #2
Compare versions as text
Try to check for 3.10 by comparing text: "3.9" < "3.10". Print the result.
print("3.9" < "3.10")
print((3, 9) < (3, 10))Myth vs fact
Myth
Python 3.9 is newer than Python 3.10 because 9 is bigger than 1.
Fact
The minor number is a whole number: 3.10 means "three point ten", the release after 3.9.
Myth
I should always install the very newest version on release day.
Fact
The language is ready on release day, but some packages need weeks or months to support a new version. For learning and for real work, one version behind the newest is the comfortable choice.
Myth
Python 2 and Python 3 are basically the same.
Fact
They differ in everyday things such as print, division and text handling. Python 2 has had no fixes since 2020. Ignore Python 2 material.
Myth
Upgrading Python will break all my code.
Fact
Minor versions keep old Python 3 code working almost always. Features are normally deprecated with warnings for at least two releases before removal, so you get notice. (Removals do happen, such as old standard-library modules dropped in 3.13, so read the release notes when you upgrade.)
Pro corner
Extra depth for experienced readers. New to this? Skip it for now and come back later.
- ▸
The yearly schedule comes from PEP 602. Before a release there are alpha versions, then betas (feature freeze) and release candidates; library maintainers test against betas so that packages are ready soon after the final release.
- ▸
Libraries state supported versions with
requires-pythoninpyproject.toml(Topic 6.7), for example>=3.11. Installers such as pip and uv refuse to install a package on a Python outside that range, which turns a confusing run-time error into a clear install-time message. - ▸
Scientific libraries such as NumPy follow a shared policy of dropping support for old Python versions on a schedule, well before those versions reach end of life. In AI work this pushes projects to stay within about three recent versions.
- ▸
Tools such as
uv(Topic 6.6) andpyenvinstall several Python versions side by side and pin one per project, so a project keeps working when your system Python changes.
Remember this
- 1
A Python version has three numbers, such as 3.13.2. The first is the major version (3). The second is the minor version (13): this is the one that matters, because each minor version adds features. The third is the micro version (2): bug and security fixes only, never new features. People usually say just "Python 3.13".
- 2
A new minor version is released every October: 3.12 in October 2023, 3.13 in October 2024, 3.14 in October 2025, and 3.15 on 9 October 2026. Each version gets about two years of bug fixes, then security fixes only until it is about five years old, and then it reaches end of life and gets nothing more.
- 3
Python 2 is history. Python 3.0 arrived in December 2008 and changed the language in ways that broke old code (for example,
printbecame a function with brackets). The world took years to move, and Python 2 reached end of life on 1 January 2020. If a tutorial showsprint "hello"without brackets, it is Python 2: close it. Everything today is Python 3. - 4
Code that uses a new feature fails on an older Python, often with a
SyntaxError, because the old Python does not know the new grammar. This is why you must know which version you are running, and why libraries state the oldest Python they support. - 5
In this course, the Run button uses Python 3.13. A feature that arrived in Python 3.8 or later carries a badge like Python 3.10+, meaning "needs 3.10 or newer". Features from 3.14 or 3.15 are shown as code you read but cannot run here; the lesson says so, and you can run them on your own computer with a newer Python.
- 6
Which version should you install? For learning, the newest version that has been out for a few months is a good choice, because the libraries you need have had time to support it. In October 2026 that means 3.14; 3.15 is brand new and some packages will take a while to catch up. Anything from 3.12 upward runs everything in the first thirteen phases, apart from the few 3.14 features that the lessons mark.
Explain it without notes
What do the three numbers in Python 3.13.2 mean?
How often is a new Python version released, and how long is each one supported?
Someone's code works on their machine but gives you a SyntaxError on a line with match. What is the most likely cause and how do you confirm it?
What does a badge such as "Python 3.10+" mean in this course?
Practice
Write a program that prints Modern Python if the running Python is 3.12 or newer and Older Python otherwise. (Copy the if and else shape from the first example in this topic; Phase 2 teaches it.)
Write a program that prints the running version in the form Python 3.13 using sys.version_info.major and sys.version_info.minor.
Put these versions in order from oldest to newest: 3.9, 3.14, 3.10, 3.8.
Trade-offs
- ↔
Newest features vs widest compatibility. Using a 3.14 feature makes code cleaner but shuts out everyone on 3.13 and older. Libraries usually target the oldest supported version; your own application can use whatever version you deploy.
- ↔
Upgrading early vs late. Upgrade early and you get speed and features sooner, with a risk that a package you need isn't ready. Upgrade late and everything is ready, but you spend longer on a version that is nearing the end of its fixes.
Done when you can
Done when you can explain major, minor and micro in a version number.
Done when you can say when new versions come out and how long they are supported.
Done when you can find the Python version in a terminal and inside a program.
Done when you can explain why 3.10 is newer than 3.9.
Done when you can say what a version badge in this course means.