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 […]

Eight Queens Puzzle in Python

Click me to play The Eight Queens Puzzle is a classic problem whose goal is to place 8 queens on an 8×8 chessboard in such a way that none of the queens share a row, column or diagonal. The version discussed here allows exploration of not just an 8×8 but an arbitrary size nxn board, […]

A Puzzle About Socks

Here’s a puzzle to help practice your computational thinking skills. Don’t forget to take it slowly and think through your answer carefully before committing. A sock drawer contains ten pairs of black socks and ten pairs of white socks. If you are only allowed to take one sock from the drawer at a time and […]

Exploring Random Walks with Python Turtle Graphics

In this post we will be looking at an idea from mathematics called a random walk. In a random walk, each step in a process is determined randomly and we are interested in the state of the process after a given number of steps. There are examples of this phenomenon happening all around us. For […]

Binary, Decimal and Hexadecimal Converter

Very often in Computer Science GCSE and A Level you are going to want to convert between different number bases such as binary, decimal and hexadecimal. Of course, you need to know how to do this manually, but it’s also very helpful sometimes to use a calculator – either to check your work or when […]

Flowcharts for GCSE Computer Science

Representing algorithms for GCSE Computer Science There are several ways to represent algorithms for GCSE Computer Science: Structured English Flowchart Pseudocode Program statements in a particular language In this article we are looking at flowcharts for GCSE Computer Science. For our example, we will create an algorithm which determines whether a given whole number is […]

GCSE Computer Science Programming Practice – Pascal’s Triangle

Whether you are going to start your GCSE Computer Science course next term or are already halfway through, it’s always a good time to do some coding practice. Here’s a fun intermediate level challenge for all you coding enthusiasts out there. Coding Pascal’s Triangle with Python Pascal’s Triangle is a fascinating mathematical structure which contains […]

Triangle Symmetries with Python Turtle

Making connections between GCSE Computer Science and GCSE Maths is a great way to turbo-charge your learning in both subjects. There are so many areas where the same knowledge can come up in both. For example coordinates, variables, inequalities, formulas and many other topics. There is an article about calculating distance here, with a game […]

Calculating Distance with Python

Calculating distance with Python I am very keen to help people connections between Maths and Computer Science. Above is a game I wrote using JavaScript. When you click on an “x” you have a 50% chance of being told the distance from the treasure. Distance between points on a 2D plane is something we calculate […]