>>> start_here.py
Python Programming
Learn Python by reading code, predicting what it will do and investigating how it works. Start with the essentials, then build towards flow diagrams, arrays, subprograms, searching, sorting and robust programs.
Read it. Predict it. Investigate it. Then build with it.
Programming foundations
01
Variables, Constants & Assignment
Store values clearly and change them when the program needs to.
02
Data Types
Choose suitable types for whole numbers, real numbers, Boolean values and text.
03
Input & Output
Display information and collect text from the user.
04
Casting
Temporarily convert values from one data type to another.
05
Arithmetic Operators
Use Python symbols for calculations, including DIV and MOD equivalents.
06
Comparison & Boolean Operators
Build conditions that evaluate to True or False.
07
String Manipulation
Concatenate, index and slice text values.
Programming constructs
08
Flow Diagrams
Represent algorithms visually using standard symbols, decisions and connected paths.
09
Sequence
Follow instructions in the order they are written.
10
Selection
Choose which block of code runs by testing conditions.
11
Iteration: Count-Controlled
Repeat a block a known number of times with for and range().
12
Iteration: Condition-Controlled
Repeat while a Boolean condition remains True.
13
Nesting Selection & Iteration
Place selection or iteration inside another programming construct.
Arrays
14
1-D Arrays
Store a fixed collection of related values using a Python list.
15
2-D Arrays
Represent rows and columns with a list of lists.
Subprograms
16
Subprograms: Procedures
Package reusable instructions that perform a task without returning a value.
17
Subprograms: Functions
Return a value from a reusable subprogram.
18
Scope, Parameters & Arrays
Use local and global values carefully, and pass arrays into and out of subprograms.
Further programming techniques
19
Random Number Generation
Generate unpredictable values for games, simulations and test data.
20
Text File Handling
Open, read, write and close text files.
21
Records with 2-D Lists
Treat each row as one record made from several fields.
Searching and sorting
22
Linear Search
Check items one by one from the beginning until the target is found or the data ends.
23
Binary Search
Search sorted data by repeatedly discarding half of the remaining values.
24
Bubble Sort
Compare neighbouring values and swap them when they are in the wrong order.
25
Insertion Sort
Build a sorted section by inserting each new value into its correct position.
26
Merge Sort
Divide data into smaller lists, then merge sorted lists back together.
Robust programming
27
Defensive Design & Validation
Anticipate misuse and reject invalid values before processing them.
28
Authentication
Confirm a user’s identity with a simple username and password check.
29
Maintainable Code
Use subprograms, clear names, indentation and comments to make code easier to understand and change.
30
Testing, Errors & Test Data
Find defects systematically and choose test data that checks the full valid range.