← 输入框|python.land|刷新

Introduction to Python

You are now ready to start learning the basics with this introduction to Python. Even if you have no prior programming experience, you should be able to get a good start here. We’ll take it slow, but before you know it, you’ll be writing small programs of your own: storing data in variables, making decisions with if-statements, repeating work with loops, and organizing your code into functions.

Before you start

This tutorial uses Python 3. Any recent version will do; the examples were checked with Python 3.15, the current release. You need two things:

  • Python on your computer. If you don’t have it yet, follow the guide on installing Python. Don’t want to install anything yet? You can also use an online version of Python.
  • A terminal. On Windows, open Windows Terminal or PowerShell. On macOS, open the Terminal app. On Linux, open any terminal.

In the terminal, type python3 and press Enter. On Windows, type python or py instead. Python prints its version and then shows a prompt of three arrows:

$ python3
Python 3.15.2 (main, Oct 25 2026, 16:57:51) [Clang 21.0.0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>Code language: Python (python)

That >>> prompt is the Python REPL, and it’s where the next lesson starts. Your version number and the details on the second line will differ, which is fine. When you want to leave, type exit() or press Ctrl+D (Ctrl+Z and then Enter on Windows). If the command isn’t found, the article on how to open Python covers each operating system in more detail.

Want to make your first Python program do something different? Run your first Python exercise in your browser and see the result straight away. It’s free to get started.

What you will learn

This introduction covers the important basics, in this order:

This introduction to Python will not dive into these subjects’ nitty-gritty details but instead touch the surface and introduce you to the basic concepts.

Further on in the tutorial, we’ll take some deep dives into specific subjects:

If you get stuck, do not hesitate to contact me with any questions you might have. Sometimes writing down the question is enough to answer it yourself, but I’m happy to help where I can. Let’s go! Click here to start learning about the REPL.

Related articles

Leave a Comment