Python Anagrams Challenge

Checking whether two strings are anagrams of each other is a fairly common coding challenge or kata. At a local meetup recently, we looked at an extended version of the challenge: not...

Power Sets with Python

A power set is the set of all possible subsets of a set. For example, if we have a set containing [A, B, C] the possible subsets are: [[], ['A'], ['B'], ['A',...

Python Challenge – 7 Puzzle

Here’s a fun little puzzle for you, which lends itself well to a Python coding solution. Find a two-digit positive integer that becomes 7 times smaller when its leftmost digit is removed....

PYTHON LOOP INVARIANTS

Writing robust code is always a good idea, but is particularly important for mission critical contexts, such as where safety is an issue. There are several historical examples of where faulty code...

TRIANGLE NUMBERS WITH PYTHON

This post explores some different ways of generating the famous Triangle Numbers with Python. Before reading on, have a go a writing some Python code to print out the first 10 Triangle...

Random Numbers with Python

Random numbers are very important in computing. Whenever you need to simulate something in the real world where the outcome is unknown, random numbers come into play. A classic example is their...

Python Loops

The ability to repeat tasks many times in rapid succession is one of the things which makes computers so useful. In programming, the technical word for repeating things is iteration. This is...

Selection Sort with Python

In this article we are going to learn how to implement Selection Sort with Python. Selection Sort is a simple and intuitive sorting algorithm. It can be performed using an auxiliary array...