< Prev  |  Home  |  Next >

Python Programs

‘Evolution of Text’ Program  //  Animated Banner Program  //  ‘Crafting Challenge’ Game  //  ‘Stay Alive’ Game  // Conway’s Game of Life // ‘Sprint’ Game // Button GUI ‘Game’ Program // ‘Scarf Designer’ Variables Program // Revision Quiz Program // Name Picker Program // Binary Images in Python // Binary Sound in Python // ‘Type The Colour And Not The Word’ Game // ‘Is It Dark Outside?’ Program

‘Evolution of Text’ Program

'Evolution of Text' Python program

Enter some text, and watch the program ‘evolve’ the answer. The program just prints a load of random text, but keeps the correct bits each time. It’s surprising how few generations the program takes to make even long pieces of text. [Code]

Animated Banner Program

Python crafting challenge

Decide on a message and create an animated banner! This program prints a basic animated banner to the console, so double-click the file to open it in the console and not the editor. This program includes challenges for customising the banner in a number of ways. [Code]

‘Crafting Challenge’ Game

Python crafting challenge

You need to craft a tent and a firepit to survive! Combine inventory items to create the items you need. This program uses dictionaries for inventory items, as well as ‘crafting rules’ for creating new items. [Code]

This program has been heavily influenced by games like ‘Minecraft‘ and ‘Don’t Starve‘. Students could add more items and crafting rules to make them.

‘Stay Alive’ Game

Python 'Stay Alive' game

A bit like a Python ‘Tamagotchi’. The aim of the game is to keep the cat alive for as many days as possible. Students can improve on this game by adding other variables, such as entertainment, boredom, etc.. They could even make the game harder, by adding a shop and making the player buy items. [Code] [Zip inc. images]

Game of Life

Python game of life simulation

A Python version of Conway’s Game of Life. Change the variables for the number of rows, columns and generations you want, and enjoy! Run the file in the console (by double-clicking it), [Code]

Sprint Game

sprint program

Written by Tom Wood. Tap the ‘z’ and ‘x’ keys as fast as you can to ‘run’ 100m. This program uses the ‘msvcrt’ module, and must be run in the console (and not the IDLE IDE). [Code]

Button GUI ‘Game’ Program

Button GUI 'game'

Can you click the ‘Quit’ button? A ‘fun’ use of a GUI button (depending on your definition of the word ‘fun’). This was a year 10 student’s first attempt at making a GUI. [Code]

‘Scarf Designer’ Variables Program

Python scarf designer program

This program allows students to change variable values to design a scarf. This would make a good early programming lesson, as the code is modified rather than being developed from scratch. [Code]

Revision Quiz Program

Python revision program

Teach Computing theory and Python at the same time! This program uses a dictionary to store questions/answers. This would make a great revision tool.

Students could add their own questions and answers to the quiz, as well as improve the program itself by adding a high-score feature, or by giving a percentage score or grade at the end. [Code]

Name Picker

Name picker

Enter names into a list, and press a button to choose one at random. GUI Example. [Code]

This program picks a random element from a list, and so can easily be adapted to contain, say, students in a group – to decide who answers a question.

A good student activity could be to adapt the program to randomly select and display 6 lottery numbers (1-49), turning the program into a ‘lucky-dip picker’. Here’s a link to a non-GUI ‘lucky dip picker’ that may help students. [Code]

Binary Images in Python

Binary images in Python

Here’s a one-off lesson (including challenges) showing how a binary (and then colour) image is represented as a binary digit (or string). [Worksheet]

Binary Sound in Python

Binary sound in Python

Make music in Python. Binary to sound converter. Enter a binary number representing frequencies of notes, along with the note duration, and hear the song it represents. Try the example song!

Students could add notes to this program (for example flat/sharp notes) by improving the ‘resolution’ of each note’s storage. [Code]

Type the colour and not the word

Type the colour and not the word

Score as high as possible by typing in the colour of the words you see, and not the word text. Harder than it sounds. GUI example. [Code]

‘Is It Dark Outside?’ Program

Never open your curtains again! Inspired by this app. This program tells you whether it’s dark outside or not. Uses a dictionary of sunrise and sunset times. This program could be improved by using more accurate data. [Code]

< Prev  |  Home  |  Next >