Blog Archives

BBC micro:bit – Tetris Game

For this challenge we are creating a game of Tetris to play on the BBC micro:bit. The game will be based on the following four shapes: The game will use the following inputs: Button A: Move current brick to the

Pygame Tutorial – Adding More Sprites

This tutorial is the fourth tutorial in a serie of five Pygame tutorials: Tutorial 1 – Getting Started with Pygame Tutorial 2 – Creating Sprites using Pygame Tutorial 3 – How to control your sprites Tutorial 4 – Adding More

The Collatz Conjecture

The Collatz conjecture is a famous mathematical mystery that has yet to be solved. It is named after Lothar Collatz a German mathematician, who first proposed it in 1937. It is based on the following number sequence: Start with any

Fireworks Display

Coding is an Art Let’s first whatch this video clip which shows how a computer program can be used to create a large scale, live and interactive fireworks display: Fireworks Code Inspired by this application of computer science, we have

CCTV Camera – Motion Detection

Getting Ready… For this challenge you will need: A Raspberry Pi with Python 2 installed, A PiCamera Follow the steps described on the following pages to make sure you have plugged the camera in your raspberry pi and that you

Timelapse Video Recording Using a Rapberry Pi

Getting Ready… For this challenge you will need: A Raspberry Pi with Python 2 installed, A PiCamera. Follow the steps described on the following pages to make sure you have plugged the camera in your raspberry pi and that you

Batman vs. Python Turtle

For this challenge we are focusing on a set of equations used to draw different sections of the Batman logo: f(x) = 1.5*sqrt((‑abs(abs(x) – 1)) * abs(3 – abs(x))/((abs(x) – 1)*(3 – abs(x)))) * (1+abs(abs(x) – 3)/(abs(x)- 3)) * sqrt(1

Blackjack Challenge

In this challenge you are going to create a blackjack game for one player. The computer will be the dealer. Rules of the game Source: wikipedia. “Blackjack, also known as twenty-one, is the most widely played casino banking game in

UK Postcodes – Distance Calculator

Challenge Your challenge is to write a Python program that asks the end-user to enter two valid UK postcodes and in return displays the distance in miles or km between those two postcodes. To complete this challenge you will first

Molecular Mass Calculator

Learning Objectives In this challenge you will improve your string manipulation techniques as well as use Python to perform some basic mathematical calculations. Did you know? The molecular weight (mass) may be calculated from the molecular formula of the substance;

Fraction Simplifier

This challenge consists of writing a program that asks the end-user to enter a fraction (numerator and denominator) and output the matching reduced fraction when the fraction can be reduced. To see what this program should do in action you

3D Challenge

The aim of this challenge is to draw a cube in 3D and to make it rotate on the screen. Drawing 3D shapes on a screen (2D) requires some mathematical formulas to convert 3D (x,y,z) coordinates into 2D coordinates (x,y).

Mastermind Challenge

Have you ever played the board game “Mastermind”? If you are not too sure about the rules of this game, you should first check this page. For this challenge we are going to create this game of mastermind where the

Home Alone – Kevin is not here!

First, let’s watch this short video clip from the movie Home Alone 2. This video clip highlights a typical case of recursion. Recursive Functions A recursive function is a function which calls itself. To make sure that a recursive function

Scrabble Challenge

This challenge consists of creating a computer program that displays a random selection of 7 letters to the end-user. Each letter is given a value based on the values used in the game of Scrabble. The user is then asked

Battleship Challenge

For this challenge we are not going to recreate a full battleship game. Instead we are going to focus on randomly placing the ships on the grid using an algorithm. The code given below uses Python Turtle to draw the

Gradient Generator

Learning Objectives By completing this challenge you will gain a good understanding of how RGB colour codes and hexadecimal colour codes work and you will apply this understanding to produce a complex algorithm. Challenge #1 Complete the code below so

Python Fractals

Fractal? A fractal is a curve or geometrical figure, which is based on a recurring pattern that repeats itself indefinitely at progressively smaller scales. Fractals are useful in modelling some structures (such as snowflakes), and in describing partly random or

Victor Vasarely’s Artwork revisited using Python

In this blog post we are looking at a specific painting from Victor Vasarely. The painting is from a serie of paintings called “Alphabet Plastique” and was painted in the 70’s. We are going to try to recreate this painting

Traffic Lights Challenge

Did you know? An embedded system is a computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints. A burglar alarm, an in-car cruise control system, a speedometer on a bike, a