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

PYTHON FUNCTIONS

Functions are a very important aspect of Python programming. They provide a way to structure your code meaningfully and also to make parts of it reusable. Think of a function as being...

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

Pseudocode

Not all algorithmic thinking occurs in front of a monitor with a keyboard at hand. In fact, it is often the case that the more complex an algorithm is, the more benefit...

Why Learn Python?

Why should you learn Python? There is a lot of talk about Python these days. It has become an extremely popular programming language. This article will take a look at some of...

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