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 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...

Python Debugging

Sometimes when debugging Python code, it is useful to be able to see the values of the variables at each step in its execution. This can be done with a debugging tool...

The Collatz Conjecture with Python

The Collatz Conjecture is an unsolved problem in Mathematics which lends itself nicely to exploration with Python. The idea is simple: Pick a positive whole number. If it’s odd, multiply it by...