Skip to content

Running Python

Python 3

Python has had two major versions: Python 2 and Python 3. They look similar but aren't fully compatible, and for years the community was split between them. That era is over. Python 2 stopped getting updates in 2020, and Python 3 is what everyone means by "Python" now.

Everything in these docs is Python 3. If you ever come across old tutorials that write print "hello" without parentheses, that's Python 2. The concepts still apply, but the syntax is different.

JunoPython 3 There used to be two Pythons, 2 and 3. That split is over: Python 2 stopped getting updates in 2020, and these docs are all Python 3. If you spot old code with print "hello" and no brackets, that's Python 2, the ideas carry over but the syntax doesn't.
JunoPython 3 Everything here is Python 3; Python 2 reached end of life in 2020. The tell for old Python 2 code is print without parentheses. Same concepts, different syntax, so read for the idea and skip the old form.
JunoPython 3 Python 2 has been gone since 2020, so "Python" now means Python 3, including everything here. The classic Python 2 giveaway is a parenthesis-free print. Concepts transfer; the syntax doesn't.

PEP

You'll see the term PEP come up from time to time. It stands for Python Enhancement Proposal, the formal process by which changes to Python are proposed and discussed. You don't need to know the process in depth, but two come up often enough to be worth knowing:

  • PEP 8: a set of rules for how Python code should be written and formatted. Things like how to name your variables, how far to indent, and when to add blank lines. You don't need to memorise it. Most code editors handle it for you automatically, and you'll naturally pick it up as you write more code.
  • PEP 20: nicknamed the Zen of Python. Type import this into any Python environment and it prints a short list of guiding principles. Things like "Readability counts" and "Simple is better than complex." It's the philosophy behind why Python looks and feels the way it does.
JunoPEP PEP stands for Python Enhancement Proposal, the way changes to Python get proposed. Two are worth knowing: PEP 8 (the style rules, your editor handles most of them) and PEP 20, the Zen of Python. Type import this to read it.
JunoPEP PEPs are how Python evolves. The two you'll actually reference: PEP 8 for style and formatting (linters apply it for you), and PEP 20, the Zen of Python, which you can print with import this.
JunoPEP PEPs are the proposal process; you don't need the machinery, only two names. PEP 8 is the style guide every tool assumes, and PEP 20 (the Zen, via import this) is the philosophy behind why Python reads the way it does.

Where to run your code

The fastest way to get started is right here in the browser. No installation, no setup required.

Running Python locally on your machine is something we'll cover in a future section. For now, the browser playground has everything you need to follow along.