Tag Archives: python

Python at Key Stage 3

a simple programI recently had the pleasure of introducing some year 8 and year 9 pupils to Python. They had previously dabbled in Scratch, but the idea of writing formal text-based programs was new to them, so we took it slow and steady.

 

The first lesson was mostly taken up with getting to know Python – we started by typing commands directly into the shell, and then they learned how to open up a new window, type a simple program into it and run the program. By the end of the first lesson they could type up print statements and simple maths statements into a program listing, save it correctly and run it.

 

Lesson 2 introduced the idea of variables and input. I reminded students at the beginning of the session how to start up a new window and create a program rather than type into the shell, and how to save their program with .py on the end to conserve the colour coding. They were also starting to discover the pleasures of debugging, and learning to look carefully at their code to spot errors. They helped each other out with this, and I showed them how to check not only the area of code that Python highlighted as a concern, but to check just before it as well, as often the error was missing speech marks or closing brackets.

 

Lesson 3 was where the real fun began, as we looked at if statements. Combining these with input meant that we could create a question and answer program, and combining that with a variable called score gave them the option of creating their very own quiz. Reactions varied, as some struggled to get their program running and grew frustrated while others started to really fly, creating inventive listings that checked for a user name and password before allowing access to the quiz. Generally, they seemed to enjoy the sessions, and my favourite reaction was that of frustration expressed as the code refused to work, followed by that surge of satisfaction and achievement as the error was spotted and fixed.

 

Our work developed by way of writing programs to solve problems, and for this I used my flash resources. This had the advantage of offering different levels of challenge and support, so that those who were able could work at a higher level while I could help those who were really struggling. By the end of the sessions all students understood a little more about how programs are made and they had learned that little details like capitals and spelling really matter. Most were starting to see how their program worked and how to fix errors and develop the functionality, while a small number really enjoyed the unit and were starting to come up with their own ideas and solutions.

 

This was only a very brief introductory look at programming, but it was enjoyable and worthwhile as a taster of computing rather than ICT, especially for those going into options, and encouraged students to think carefully and increase the accuracy of their written work. I saw expressions of satisfaction from both ends of the ability level, as those who struggled finally got something working while those who experimented showed off what they had managed to work out for themselves. Students whose first reaction as “This is stupid” moved over to “Oh, I see what the problem is”, as they learnt that the computer would do exactly what was it was told to do, and discovered for themselves the harsh realities of Garbage In Garbage Out. Even if they never see another Python statement, I believe they’ve taken away the understanding of how carefully you need to express yourself in order to be properly understood and how accuracy leads to better results.

 

As a result of my experiences I’ve developed a workbook and some flash resources, which you can find on my website here.