Background

This introductory coding project, using Python 3 as a simple word-processor, builds on the success of the Literacy from Scratch model. It encourages the development of (very) short story-writing at KS2 or KS3 (ages 10 to 12 years). These stories are then created using Python 3, and in doing so, a series of elementary coding concepts is developed. These are listed later.

Students at secondary school level in the UK are required to be familiar with two computer programs. This frequently involves learning coding through Scratch, a visual coding program, often started at primary level as the first required program. Python, a more powerful text-based language, is often added at lower secondary level (ages 11 to 14) but could be introduced in Year 6…

Python is widely used in industry, powering:

- Google (YouTube)

- Facebook

- Dropbox

- Yahoo

- NASA

- IBM

- Mozilla

And so it is very cool…

The process

In English lessons, students in Years 6 or 7, write a very short story which includes some dialogue. This story is then taken to the computer room, where, using Python 3, it can be reworked in the Idle programming window, and printed out in the Shell window as an elementary Python program. This model therefore adds creative and cross-curricular elements to the coding process. Teachers could also add many more mathematical concepts into the stories, as well.

The coding in Python

Output

Notes:

1. This story, and all of the coding above, was written in four short sessions by a Year 6 student, who had not seen Python before. See Resources below.

2. Comparison might usefully be made between Python and the historically more recent Scratch programs.

Teaching suggestion:

Place the two windows side by side on the White Board, as this allows for discussion of the comparison between the Shell window (program output on the left, below) and the coding window (on the right).

Coding

The coding process involves learning the following elementary concepts:

- Function: print in purple text (above right)

- Output (blue text) and input (in the coding window)

- Strings: the green text of the story is written out in strings between speech marks

- Tables (in this case, the 7 times table, and others. Just type a different number!)

- Variables (choosing which table is to be printed out)

- Range: how long the times table is to run for (up to 12 calculations in this case)

- As well as accuracy in coding, with spaces, brackets, speech marks, blank lines () and so on

I think this is enough as an introduction…

Resources

- Highly recommended Python videos (introducing the Python Idle editor) by Dr. Ann Dawson

- Coding for Beginners using Python (Usborne) Includes Python games and a useful Glossary