Command Palette

Search for a command to run...

Hectal
Phase 0Beginner1 of 18 in Python

Start Here: Programming and Python from Zero

What a program is, what Python is, how to run your first lines here and on your own computer, and how to read the errors every beginner meets.

This phase assumes you have never written a line of code. It starts with what a program actually is, then explains what Python is, why almost all AI work is written in it, and how its versions work.

You will run real Python on this page from the first topic, with nothing to install. Then you will install Python on your own computer, run a file from a terminal, try the interactive shell, and learn the handful of rules (indentation above all) that shape every Python program.

The phase ends with two skills that separate people who give up from people who keep going: reading an error message calmly, and understanding what Python really does with your code when you press Run.

0/8 · 0%
8 topics ~4 h 30 code blocks & diagrams
Start with the first topic
1
0.1

What a Program Is

A program is a list of exact instructions that a computer follows in order. Almost every program takes some input, does some processing, and produces output; the text you write is called source code, and a mistake in it is called a bug.

27 min 1 diagram 3 code practice

2
0.2

What Python Is and Why the AI World Runs on It

Python is a free, general-purpose programming language designed to be easy to read. It is the main language of AI and data work because it is quick to write and because its heavy number-crunching is done by fast libraries written in C, which Python code drives.

28 min 4 code practice

3
0.3

Python Versions and the Version Tags in This Course

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.

26 min 4 code practice

4
0.4

Run Your First Program: Here, Then on Your Computer

You can run Python on this page with the Run button and nothing installed. To work on your own computer, install Python from python.org, save your code in a file ending in .py, and run it from a terminal with python hello.py (python3 on macOS and Linux).

26 min 3 code practice

5
0.5

The Interactive Shell (REPL)

Typing python with no file name opens the interactive shell, where Python runs each line as soon as you press Enter and shows the result. It is the fastest way to try an idea, check how something behaves, or use Python as a calculator.

25 min 3 code practice

6
0.6

Anatomy of a Python Program

A Python program is a sequence of statements that run from top to bottom. Indentation (four spaces) is part of the grammar and shows which lines belong together, # starts a comment, and capital and small letters are different.

28 min 1 diagram 3 code practice

7
0.7

Reading Error Messages and Tracebacks

When Python cannot run a line it stops and prints an error message. Read it from the bottom: the last line names the kind of error and what went wrong, and the lines above it (the traceback) show the file and line number where it happened.

29 min 4 code practice

8
0.8

How Python Really Runs Your Code

When you run a file, Python first compiles your source code into bytecode, a compact set of simple instructions, and then a virtual machine carries those instructions out one by one. The standard Python that does this is called CPython; knowing these steps explains Python's error behaviour and its speed.

28 min 1 diagram 3 code practice

Practise this phase

Hands-on exercises: write the code, run it, and press Check to have it tested automatically.