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

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

Algorithm Animations

If a picture is worth 1000 words, an animation is worth even more! Fully understanding an algorithm can be hard, and it is helpful to be able to reason about it in...

Analysis of Algorithms with Python

The efficiency of algorithms is important. Imagine a program that took centuries to calculate the solution to a problem (like Deep Thought from the Hitchhiker’s Guide to the Galaxy), or needed more...

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