basforge

Search titles, text and the “If it doesn’t work” cases.

    RU
    Section · language

    Python

    The language of scripts, data and AI. Go from the first run to modules and classes: one idea per chapter, a working result first, then how it works. Practice is one-evening tasks for your own computer, server and network.

    OverviewPython: where it came from, why it became the language of AI, and where to start
    13 chapters · 5 parts7 of 13 written
    Dark — read, light — written, empty — in progress. Marks stay in this browser only.
    Start: chapter 1 · Running: the REPL and a .py file

    Chapters

    Part 1

    Basics

    Run Python and see what a value is made of.
    Part 2

    Program flow

    Decisions, repetition and your own functions.
    Part 3

    Data

    Collections of values: in order and by key.
    8soonLists and tuplesFive ping times: the worst, the best, the median — and why the average lies.
    9soonDictionaries and setsLookup by key in one step and counting without repeats.
    Part 4

    Files and errors

    Working with the disk and with what goes wrong.
    10soonFiles and pathspathlib and with open: read, write, walk a folder.
    11soonErrors and exceptionsRead a traceback and catch only the errors you expect.
    Part 5

    Bigger code

    Other people’s code from packages and your own data types.
    12soonModules and packagesimport, pip and virtual environments.
    13soonClassesYour own data type: when a class is needed and when a dictionary is enough.

    Practice: one-evening tasks

    A working script for a task of your own. Start here if you like: each manual explains what it needs, the chapters go deeper.

    Reference

    Cheat sheets to keep open next to the editor.

    Cheat sheet · soonString methods
    Cheat sheet · soonList and dictionary methods
    Cheat sheet · soonPaths and files: pathlib
    Cheat sheet · soonPython errors: the message and what it means