For the instructor
This book contains all the example programs used in my CoderDojo class to teach Python programming. The primary goal of the class is to teach programming using action games to make learning more interesting. Some of the examples are entirely focused on introducing new language concepts or showing how the Pygame Zero API works, but most are a mixture of both.
The intention is that each program in the example chapters is brief, complete and introduces only one or two new concepts.
The programs are short so that students can feasibly type them in during the class. Typing for themselves is very valuable for beginners, because it helps them learn to type, and to type precisely without mistakes (which show up as syntax errors). Even if it takes them a while, they should feel proud when they type a program correctly in the end! 1
Each program is complete to avoid the confusion caused by worksheets that tell a student to add lines to a program piecemeal. If they make an error or omit a step they may never recover and not produce a working program. Also being complete and separate means the whole class can be told to skip to the same program and it won’t matter so much that some of them didn’t complete all the prior programs.
Introducing ideas one or two at a time allows the students to learn mostly through doing and observing the output of each program rather than memorizing. To this end the order of the programs within each chapter has been carefully selected. The chapter ordering is more loose and it is possible to skip back and forth between chapters. If the text quizzes or the Python fundamentals are boring the students, skip ahead to the graphical games, then come back to the earlier examples when necessary.
Following each program are some ideas for how students can modify the program. Hopefully they will go further and modify these programs into their own unique games! The difficulty of these suggestions varies, to accommodate students of different age and ability.
This book may be suitable for self-teaching by a motivated learner, but does not attempt to be comprehensive or give detailed explanations because it is intended to be used in a class with an instructor who will fill in the gaps as needed by the students.
The second edition
I discovered two important things from feedback from the first edition:
It’s not possible to learn coding with only a single lesson each week. Therefore if that is all we have, the time is better spent inspiring interest in the subject rather than memorizing syntax or wrapping their heads around abstract concepts. Those who are motivated to learn more in their own time will require more syntax and concepts, of course, and hence the Fundamentals chapter has been greatly expanded for their use.
Many students wanted to create larger games than the simple examples given in the first edition. It was always the intention that they absorb the knowledge from the examples and then go on to greater larger games of their own but some will require more hand-holding.
Therefore there are four new chapters of tutorial style examples. These are intended to be done in class, with the initial code file given to the students to save time. They are intended to create a sense of accomplishment as each subsequent modifcation improves the game, and also to allow lots of scope for student creativity and customisation.
As noted above, tutorials can become confusing, but I hope the class instructors can resolve any issues.
- 1
For writing essays nowadays people can use voice input and touch-screen input, but for programming the majority of programmers still type on a keyboard. There’s no sign of this changing in the immediate future, so practising keyboard skills now is still very important for the future. Students can practise at home with a program such as TuxType. That being said, many programs contain similar code, so it’s also a useful skill for them be able to copy and paste from their other programs.