← 输入框|python.land|刷新

Welcome To The Python Tutorial

Learn Python with our free tutorial, suitable for beginners. It contains carefully crafted, logically ordered Python articles full of information, advice, and Python practice! Hence, it helps both complete beginners and those with prior programming experience get up to speed with Python.

How to learn Python?

If you’re in a hurry to learn Python, I’ll give you some shortcuts to get you started quickly. You have two options:

  1. Try Python for yourself. Run and change a small program in your browser, with nothing to install. All courses on our new learning platform are free to access. Try your first Python exercise.
  2. Use the free Python tutorial that we kick off right on this page. Simply keep reading. You can switch to the interactive Python Fundamentals I course on learn.python.land at any moment.

Why learn Python?

Since you’re here, you probably know why, but let’s quickly review Python’s advantages!

Python is one of the world’s most used and most popular programming languages. It’s powerful, versatile, and easy to learn. Python is widely used in various applications, some notable ones:

  • Web development
  • Data Science
  • Data analysis
  • Machine learning
  • Artificial Intelligence (AI)
  • Scripting and tooling

Many people say that Python comes with batteries included. It’s a fun way to state that it includes a comprehensive base library. In addition, because so many people use Python, hundreds of thousands of high-quality libraries and frameworks exist to get things done quickly and without hassle. You can do a lot with a little bit of Python code!

Is it still worth learning now that AI can write code? I think so, and I use AI tools every day. They write a lot of code quickly, but someone still has to decide what the program should do and check whether what came back is right. You can only do that if you can read and reason about code yourself. If you want to think this through before you start, the free short course Is Python Worth Learning? has a chapter on programming in the age of AI.

Learning Python is a no-brainer, and I promise you will be up and running quickly with this Python tutorial. Regardless of your future in IT, it will be a helpful tool to have in your toolbox!

Why this Python tutorial?

And here’s why you should read this Python tutorial instead of all the others:

  • This free Python tutorial is easy to read and is in plain English.
  • It’s written by an experienced writer and tutor who puts great care into the learning material and the order in which it is presented.
  • It’s full of example code you can copy and run yourself, and it links to free interactive lessons on learn.python.land where you edit and run code in your browser. Trying things out helps you learn concepts much faster.
  • This tutorial is practical. While focussing on getting stuff done in the real world, I also explain how and why things work instead of teaching you tricks.
  • It provides carefully vetted links on most pages to deepen your knowledge.
  • Did I mention it’s completely free, with no strings attached?

About the instructor

So, what makes me eligible to teach you Python? Let me introduce myself!

I’m Erik, and I’ve worked as a software engineer for over 25 years. I hold an MSc in computer science and used many programming languages in my career, but Python is my absolute favorite! Although I love programming and building complex systems, I also love writing and teaching. Hence, I combined these two by writing tutorials and courses on this site.

Eventually, I got fed up with the limited copy-and-paste code examples and wanted example code that is editable and runnable in the browser. That’s what the courses on learn.python.land are for: you edit and run code right in the lesson, and exercises check your answer.

Stay up-to-date

Try my Python newsletter. You can subscribe here or at the bottom of any page. I use it to:

  • Inform you about current Python trends
  • Point you to new and existing articles you might like

Python history

Let’s start by defining Python more precisely. Python is a computer programming language. Or, in other words, a vocabulary and set of grammatical rules for instructing a computer to perform tasks. Its original creator, Guido van Rossum, named it after the BBC television show ‘Monty Python’s Flying Circus.’ Hence, you’ll find that Python books, code examples, and documentation sometimes contain references to this television show.

In 1987, Guido worked on a large distributed operating system at the CWI, a national research institute for mathematics and computer science in the Netherlands. Within that project, he had some freedom to work on side projects. With the knowledge and experience he had built up in the years before, working on a computer language called ABC, he started writing the Python programming language.

Python is easy to learn, and it’s designed around a set of clearly defined principles (the Zen of Python) that encourage Python core developers to make a language that is unambiguous and easy to use.

Extensible

In a 2003 interview with Bill Venners, Guido mentioned what was probably the biggest innovation in the new language:

I think my most innovative contribution to Python’s success was making it easy to extend. That also came out of my frustration with ABC. ABC was a very monolithic design. There was a language design team, and they were God. They designed every language detail and there was no way to add to it. You could write your own programs, but you couldn’t easily add low-level stuff.

Guido van Rossum

He decided you should be able to extend the language in two ways: by writing pure Python modules or by writing a module entirely in C. The former is obviously easier, but the latter allows for fast, high-performance modules like NumPy. It was a success because his CWI colleagues, the users, and Guido himself immediately started writing their own extension modules. The extension modules let you do all sorts of things. Just a small selection of modules that exist today:

  • graphics libraries,
  • data processing and data science libraries like NumPy and Pandas,
  • AI and machine learning libraries,
  • libraries to work with all sorts of file formats (like JSON, YAML),
  • all kinds of libraries to use and connect external services,
  • build websites and website backends (e.g., Django, FastAPI)
  • … and so on

Since its inception, Guido has been actively involved in Python’s development. After a short retirement in 2019, he joined Microsoft in 2020, where he worked on making Python faster.

A timeline

The following figure shows a global timeline of Python’s historical and most defining releases:

A graphical timeline of Python history
The history of Python

The figure ends in 2020, when Python 2 reached its end of life. Since then, a new Python 3 version has come out every October. Here are the highlights:

  • Python 3.10 (2021): structural pattern matching with match and case, and much clearer error messages.
  • Python 3.11 (2022): a big speed-up, often 10 to 60 percent faster than 3.10, plus exception groups and tomllib.
  • Python 3.12 (2023): more flexible f-strings and a new syntax for type parameters.
  • Python 3.13 (2024): a new interactive interpreter with colors and multi-line editing, and experimental builds without the global interpreter lock (GIL).
  • Python 3.14 (2025): template strings (t-strings), syntax highlighting in the interpreter, and official support for the free-threaded build without the GIL.
  • Python 3.15 (2026): explicit lazy imports, a built-in frozendict, and UTF-8 as the default encoding when reading and writing files.

Python 3 isn’t fully backward compatible with Python 2, so old Python 2 code may need changes to run. For anything new, use the latest Python 3.

Run Your First Python Program

Let’s dive in directly! We’ll run the Python code from your browser to get started quickly. Later, you’ll learn how to install Python on your computer.

To run Python in your browser, open the free first lesson of our Python Fundamentals course: Meet the Python Playground. It gives you a code editor with a Run button, so you can type in Python code, run it, and see the result. Nothing to install. Try it with the program below!

print('Hello world')Code language: Python (python)

Output:

Hello world

Hello World

There’s a tradition in which programming tutorials, books, and courses start with a so-called Hello World program. A Hello World program simply prints the words “Hello world” to the screen. The program above does precisely this, using the print() function.

The print() function takes anything you put between the parentheses and prints it to the screen. But we must feed it the correct type of data for it to work. For example, we need to put text in Python between quotes. In the world of computer programming, we call this a string.

Quotes around strings are essential because they precisely mark the start and end of a string. This way, a string is easy to recognize for Python. Here are a few more examples of valid strings:

'Hello world'
'My name is Eric'
'This one is a bit longer.'Code language: Python (python)

You can print these strings or a string of your choosing in the playground lesson, and I encourage you to do so! Like most things in life, programming requires practice to master it.

Navigating the free Python tutorial

I did everything I could to make browsing the free Python tutorial as easy as can be! Primarily, you can use the top menu. In addition, navigational links at the top and end of each page guide you to the next topic or return to the previous one. I also link to related pages to deepen your knowledge.

I carefully ordered the course topics so that you can start from the beginning and work your way up. However, feel free to browse around!

Learn it interactively

Reading is a good start, but you learn to program by writing programs. The free tutorial and our interactive courses cover the same ground, so you can switch between them at any point. In the courses, every lesson ends with code you write and run in your browser, and you get feedback right away. Nothing to install, and you can start for free. Try your first Python exercise.

Here’s how the chapters of this tutorial line up with the courses:

How can you help me?

You—yes, that’s you—can help me improve this course in several ways.

1. Get in touch if you…

  • find any mistakes,
  • think something can be improved,
  • or something is unclear to you.

2. Buy me a coffee

I’ve been working on this site since 2020, spending most of my spare time here with all my heart and soul. It must have been 1000s of hours by now. I hope it shows, and I genuinely hope you have a lot of fun learning Python here.

If you’d like to support my work, you can buy me a coffee. Your support helps me keep writing and updating the content!

3. Follow me

You can follow me on Bluesky for updates on new content, links, quizzes, code snippets, etc. This site also has a dedicated mailing list; subscribe to my newsletter. It’s low-volume and mainly contains new articles I wrote and interesting links to read.

Let’s go and learn Python!

Ready to learn Python? To follow this tutorial, use the navigational buttons at the bottom and top of each page, or browse around using the site menu on the right (or top if you have a small screen). If you have any questions, don’t hesitate to contact me through the contact form.

Related articles