Every pricing model, backtest, and risk report in this vault eventually reduces to a sequence of instructions a machine executes with total literalness — it will do exactly what you told it, not what you meant. Before writing a single line of Python, it pays to be precise about what a program even is and why "just tell the computer what you want" is not, in general, something you can do. This note lays down the vocabulary — algorithm, program, syntax vs. semantics, the three ways a program can go wrong — that every later stage of this unit assumes silently. It closes with the practical question a beginner always asks first: what happens when I run something that isn't quite right?
Learning objectives. By the end of this note you should be able to:
- distinguish declarative knowledge from imperative knowledge and explain why only the latter is directly executable;
- state the Church–Turing thesis and its practical corollary (Turing completeness) for choosing a programming language;
- classify a Python failure as a syntax error, a static semantic error, or a runtime/logic error, and say which stage of execution catches each;
- explain why "runs to completion and prints a plausible-looking wrong answer" is the most dangerous failure mode, not the least.
In this lesson
- From recipes to algorithms
- Why any general-purpose language will do
- Syntax, static semantics, and semantics
- Three ways a program can misbehave
The full lesson, with worked examples and exercise solutions, is for members.
Read the full lessonNew to SelfMadeQuant.com? See membership options or browse the Python for Quantitative Finance syllabus.