What a pattern is
A design pattern is a named, reusable solution to a design problem that keeps coming up. The 1994 book Design Patterns, by four authors nicknamed the Gang of Four, catalogued 23 of them. Here are four, one per board.
Four patterns
Checkout needs a pricing rule but does not care which one. Hand it full, then sale: the rule slides out and the other slides in. The total goes from 100 to 90, and Checkout's own code never changes.
A button keeps a list of functions to call. Sound, a counter and a logger each subscribe: they add themselves to the list. The button never learns what they do, only that they want to hear.
Click the button and it calls every function on its list, in order. One change, 3 reactions. This is how user interface events work: a web page's addEventListener signs up a listener in exactly this way.
Your code asks make_shape for a "circle" and gets a Circle back; ask for "square" and a Square comes out. Your code never names a class, so new shapes can be added inside the factory alone.
The app calls read(), but the old class only has get_text(). A small adapter offers read() and passes each call on as get_text(), like a travel plug. Neither the app nor the old class changes.
Using them well
A pattern name is a shortcut: "use an observer here" tells a teammate a whole design in four words. Patterns are not laws to follow. The book describes when each one fits and what it costs.
Add a pattern when the problem is really there, not just in case. In Python the pricing rules here are plain functions, and sorted(words, key=len) already passes in a strategy. The simplest code that works is usually best.
The Python
# step 1/8 · patterns Design Patterns (1994) Gamma, Helm, Johnson, Vlissides 23 patterns in three groups: creational 5 how objects get made (Factory Method) structural 7 how pieces fit together (Adapter) behavioral 11 how objects share the work (Strategy, Observer) each one: a name, a problem, a solution, the trade-offs
Every Python example in the step details runs as written in Python 3 and prints the lines shown after it. The book has two factory patterns, Factory Method and Abstract Factory. The make_shape function here is the simpler "factory function" many Python programs use; it has the same goal: the caller asks for a kind of thing, not a class.