Python · Foundations
Learn Python
The syntax and the mental model. Short, runnable, no fluff.
Learn the Basics
01
Hello, World!
Python is a very simple language, and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code.
02
Variables and Types
Python is completely object oriented, and not “statically typed”. You do not need to declare variables before using them, or declare their type.
03
Lists
Lists are very similar to arrays. They can contain any type of variable, and they can contain as many variables as you wish.
04
Basic Operators
This section explains how to use basic operators in Python.
05
String Formatting
Python uses C-style string formatting to create new, formatted strings.
06
Basic String Operations
Strings are bits of text. They can be defined as anything between quotes: As you can see, the first thing you learned was printing a simple sentence.
07
Conditions
Python uses boolean logic to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
08
Loops
There are two types of loops in Python, for and while. For loops iterate over a given sequence.
09
Functions
Functions are a convenient way to divide your code into useful blocks, allowing us to order our code, make it more readable, reuse it and save some time.
10
Classes and Objects
Objects are an encapsulation of variables and functions into a single entity. Objects get their variables and functions from classes.
11
Dictionaries
A dictionary is a data type similar to arrays, but works with keys and values instead of indexes.
12
Modules and Packages
In programming, a module is a piece of software that has a specific functionality.
13
Files and Context Managers
Reading and writing files, and the `with` statement that guarantees cleanup — the single most idiomatic construct in Python.
Advanced Tutorials
01
Generators
Generators are very easy to implement, but a bit difficult to understand. Generators are used to create iterators, but with a different approach.
02
List Comprehensions
List Comprehensions is a very powerful tool, which creates a new list based on another list, in a single, readable line.
03
Multiple Function Arguments
Every function in Python receives a predefined number of arguments, if declared normally, like this: It is possible to declare functions which receive a variable number of arguments, using the following syntax: The “therest” variable is a list of variables, which receives all arguments which were given to the “foo” function after the first 3 arguments.
04
Regular Expressions
Regular Expressions (sometimes shortened to regexp, regex, or re) are a tool for matching patterns in text. In Python, we have the re module.
05
Exception Handling
When programming, errors happen. It’s just a fact of life. Perhaps the user gave bad input. Maybe a network resource was unavailable.
06
Sets
Sets are lists with no duplicate entries.
07
Serialization
Python provides built-in JSON libraries to encode and decode JSON. In Python 2.5, the simplejson module is used, whereas in Python 2.7, the json module is used.
08
Partial functions
You can create partial functions in python by using the partial function from the functools library.
09
Code Introspection
Code introspection is the ability to examine classes, functions and keywords to know what they are, what they do and what they know.
10
Closures
A Closure is a function object that remembers values in enclosing scopes even if they are not present in memory.
11
Decorators
Decorators allow you to make simple modifications to callable objects like functions, methods, or classes. We shall deal with functions for this tutorial.
12
Map, Filter, Reduce
Map, Filter, and Reduce are paradigms of functional programming.
13
Type Hints
Optional annotations that a checker enforces before your code runs. Python stays dynamic; you get most of the safety anyway.
14
Dataclasses
A decorator that writes the boilerplate for classes that mostly hold data — which is most classes.
15
Async and Await
Concurrency for I/O-bound work — and the one mistake that silently makes an async program slower than the synchronous version.
Data Science Tutorials
01
Numpy Arrays
Numpy arrays are great alternatives to Python Lists.
02
Pandas Basics
Pandas is a high-level data manipulation tool developed by Wes McKinney. It is built on the Numpy package and its key data structure is called the DataFrame.
Get the Python agent pack
A battle-tested AGENTS.md, the review checklist, and the failure-mode cheat sheet for Python. One email, then occasional updates when the tooling shifts. No course pitch.
AGENTS.md now — no email needed.