Chapters
Python114 chapters

BasicsChapter 1 of 114

Introduction

What Python is, what it is good at, and what you need before you start.

What Python is

Python is a programming language. You write instructions in a text file, and an interpreter reads that file top to bottom and carries the instructions out.

Two decisions shape almost everything else about the language:

  • It is interpreted. There is no separate compile step, so the gap between

writing a line and seeing what it does is about a second.

  • It is dynamically typed. You never declare that something is a number.

You put a number in it, and it is a number until you put something else in.

The result is a language you can read out loud. This is a complete program:

Python
print("Hello, world!")

Output

Hello, world!

What it is used for

Python is not the fastest language, and it is not trying to be. It wins where the time that matters is your time rather than the processor's:

  • Data analysis and machine learning, where the heavy arithmetic happens inside

libraries written in C anyway

  • Scripting and automation, the ten-line jobs that would take a page elsewhere
  • Web backends, with frameworks like Django and FastAPI
  • Teaching, because there is so little ceremony between an idea and a result

What you need

Nothing, for this tutorial. Every example on these pages runs in your browser, so you can change the code and run it again without installing anything.

To write Python on your own machine you need two things: the interpreter itself, and somewhere to type. The next chapter covers both.

How this tutorial works

Each chapter is one idea, short enough to read in a few minutes. Every example has a Run button, and the code is editable — change it, break it, run it again. Breaking an example on purpose is one of the faster ways to learn what it does.

At the end of a chapter you get a few questions to check the idea landed, and a link to exercises that make you write the code yourself.

Test yourself

2 questions

What does it mean that Python is interpreted?

Show the answer

You run the source directly, with no separate compile step — There is no build step between writing a line and running it, which is why the feedback loop is so short.

What does dynamically typed mean?

Show the answer

A variable takes whatever type you put in it — The value carries the type, not the name. That is also why a typo in a name is only caught when that line runs.

Next chapter

Get Started

Install Python, run a file, and use the interactive prompt.