BEYOND THE BOOK
Understand the ideas.
Make the code your own.
Twelve short field notes for the questions that deserve more room than a story can give them. No experience assumed.
NEW TO ALL OF THIS?
Start with the idea.
Then try a little code.
Read What is a program?, then Syntax and Variables. Continue in order, or follow the concept links in any activity. History notes are optional detours.
FIELD NOTE 01
What is a program? Start here.
A program is a set of instructions a computer can carry out. An algorithm is the plan behind those instructions. Python is one language for expressing that plan.
Understand it →FIELD NOTE 02
Why does Python look like that?
Syntax means the rules for writing valid code. Python uses punctuation, keywords and indentation to make the structure of a program precise.
Understand it →FIELD NOTE 03
Names, values and changing state
A variable is a name bound to a value. Assignment with = binds a name; it does not ask whether two things are equal.
Understand it →FIELD NOTE 04
Numbers, text and input
The value 12 is a number; "12" is text. Types describe what kind of value you have and which operations make sense for it.
Understand it →FIELD NOTE 05
Decisions, comparisons and Booleans
A Boolean is either True or False. Conditions let a program choose which instructions to run using those values.
Understand it →FIELD NOTE 06
Loops: repeat with a reason
A loop repeats a block of instructions. A for loop visits a sequence; a while loop repeats while a condition is true.
Understand it →FIELD NOTE 07
Functions: give an idea a name
A function is a named piece of reusable behaviour. Parameters name its inputs, and return hands a result back to the caller.
Understand it →FIELD NOTE 08
Lists, dictionaries and a case file
A list keeps items in order. A dictionary connects keys to values. Choose the structure that matches the question you want to ask.
Understand it →FIELD NOTE 09
Modules: tools you do not have to rebuild
A module groups reusable Python code. import makes that module available so your program can use its names.
Understand it →FIELD NOTE 10
Bits, bytes and secret-looking messages
Representation is how information is written down. Hexadecimal and Base64 encode data; they do not make it secret.
Understand it →FIELD NOTE 11
Debugging: turn a surprise into a question
Debugging means finding and correcting the reason a program behaves differently from your intention. An error message is evidence you can use.
Understand it →FIELD NOTE 12
A short history of Python and readable code
Programming languages are designed by people. Their syntax reflects choices about readability, expression and the jobs people want computers to do.
Understand it →A few words you’ll meet
- Algorithm
- A step-by-step method for solving a problem.
- Syntax
- The rules for writing valid code.
- Expression
- Code that evaluates to a value, such as 2 + 3.
- Statement
- An instruction, such as assigning a value to a name.
- State
- The values a program currently remembers.
- Interpreter
- Software that runs a program written in a language such as Python.
- Bug
- A mistake that makes software behave unexpectedly.
- Library
- Reusable code that supplies tools for other programs.