I had a phone interview for a Python job the other day. It started out really well, he was very impressed with my CV and called me a ‘rocket scientist’. But then we got down to the technical questions and my brain decided to go out to lunch, and (yet again) I managed to snatch defeat…
Beginner
Hello World 2, in Python 3
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…
A Quick Introduction to Python 3 Programming
This Quick Introduction to Python 3 aims to teach you just enough Python, so that you can get started in computer programming! First, you’ll want to install Python 3 or you can use the in-browser Trinket near the bottom of the page – just edit the code directly in there. If you have Python installed, you can…
A Graphical Dice Simulator
This PyGame program simulates the roll of a die (or dice if you prefer). It’s a fairly simple, straightforward thing to do, though it may be worth noting that the spots display is oh-so-slightly clever. Some spots appear in more than one number, e.g. the middle spot is in all the odd numbers, hence the…
Editors & IDEs
A text editor is all very well for simple notes, but for programming the basic text editor will quickly become very tedious. For example, Python uses code indentation to indicate ‘blocks’, using tabs or spaces (4 spaces recommended for each level of indentation). It will help a lot if the editor you use ‘knows’ Python!…
Compute Average Heights
This is a simple program to compute average heights. In a loop, it prompts the user for heights, inputs a text string and converts it to a ‘real’ number, sums them, and divides by the number of heights. Exit is signalled by negative height, after which the sum of the numbers is divided by the number of…