Hello, Python!

Hello World 2, in Python 3

24th March 2016

Hello World is the famous minimal introductory program for many programming languages. But as soon as it’s served its purpose, it’s discarded in the dust of history for more exciting things, such as data types or expressions… This is politically incorrect discrimination and must be stopped! This loyal and true didactic program should have the right to […]

Guess my number?

Number guessing game

1st October 2015

The number guessing game incorporates several simple but important elements of elementary programming and is a good candidate for an introductory programming example. If you’ve seen any programming course, you’ve probably seen the “Hello World” program. In Python it’s: print (“Hello World”)This is done to get the student(s) quickly to the point of having successfully installed […]

Stars & Stripes

Stars and Stripes

4th July 2015

A variation on the Stars and Stripes American Flag for Independence Day. It’s an exercise in the use of transparency in Pygame. The stripes are made transparent so the stars image behind shows through.

Rainbow Flag

Rainbow Flag in Pygame

29th June 2015

This little Pygame program paints the Rainbow Flag, as used by the LGBT movement. It illustrates: Importing the Pygame library RGB colours in hexadecimal Python’s for loop using the enumerate() function Filling a rectangular area in Pygame Updating display with flip() Saving the image

A Fake Circle made of Straight Lines

15th June 2015

Inspired by this post on Reddit, I wrote this little script to do the same thing. The circle is an illusion created by 100 straight-line tangents to an invisible circle. The tangents are created by drawing a chord in a larger concentric circle, and moving it’s endpoints around by equal increments 100 times. The larger […]

Easy Graph Plotting with Pyplot

7th May 2015

Graphs (also known as charts) are an indispensible visual aid for conveying a lot of data in an easy-to-digest form. Everyone is familiar with graphs in everyday life, such as those showing trends over time, e.g. world population, global warming, the cost of living, interest rates, etc. They are of fundamental importance in the STEM […]

Square Spiral

18th April 2015

This is a very simple introduction to Turtle graphics. The turtle starts in the middle of the window, moves forward a small distance, turns right, moves forward a slightly longer distance, right again, even further this time… until the distance equals or exceeds a given limit. Turtle graphics is a popular way for introducing programming […]