Python Sets and a River Crossing Puzzle

Have you heard of the puzzle about the farmer, the wolf, the goat and the cabbage? You can play it here (click the “run” button to start): There are many different ways to implement the logic, but here I chose to use Python Sets. My goal here is to teach about Python programming. If you […]

2-Dimensional Arrays in Python for Computer Science GCSE and A Level

2-dimensional arrays are extremely important data structures in programming, and you need to understand them for Computer Science GCSE and A Level. They can be very confusing to begin with, and you should make sure you are confident and competent with 1-dimensional arrays before learning about them. For the purposes of GCSE and A-Level Computer […]

Node Class for a Linked List with Object Oriented Python

When you come to study Data Structures such as Stacks, Queues, Linked Lists and Binary Trees for A Level Computer Science, you will often make use of Object Oriented Programming. That is a bit of a double whammy if you are not yet very confident with OOP, and it can seem a bit overwhelming. I’ve […]

Graphs in Python for A Level Computer Science

Part 1 – Networkx Basics networkx is a powerful python package that allows you to easily work with graphs in Python. Combining it with the matplotlib.pyplot package even makes it simple to draw graphs. This is very useful when learning or teaching about graphs for A Level Computer Science. # Auto formatting – completely optional, […]