Preface
About the Book
This book has been written to facilitate a two semester Python programming course for eighth grade students. The material begins assuming no prior programming experience and culminates with intermediate programming topics such as object-oriented programming and the Pyxel graphics library.
The Legend of Parzival
Long ago, in the time of King Arthur, there lived a young man named Parzival. His father, a great knight, had died in battle, and his mother raised him deep in the forest, away from the world of knights and combat. She wanted to protect her son from the dangers that had taken her husband.
Parzival grew up innocent and naive, knowing nothing of the ways of the world beyond the forest. One day, he encountered a group of knights in shining armor. Amazed by their appearance, he decided he wanted to become a knight too, despite his mother’s warnings.
Setting out on his journey, Parzival faced many challenges. He was awkward and didn’t understand the rules of knightly behavior, often making mistakes that got him into trouble. But he was brave and determined, and he slowly began to learn.
His greatest adventure began when he stumbled upon the castle of the Fisher King, keeper of the Holy Grail. The Fisher King was wounded and in great pain. Parzival was served a grand feast, and he saw a strange procession: a bleeding lance and a glowing cup were carried through the hall.
Parzival, remembering advice he’d received about not asking too many questions, said nothing. This turned out to be a terrible mistake. He learned later that if he had asked about what he saw, he could have healed the Fisher King and become the new Grail King himself.
Ashamed of his failure, Parzival set out on a quest to find the Grail castle again. He faced many trials and grew wiser with each challenge. He learned about humility and the importance of asking the right questions.
After years of searching and many adventures, Parzival finally found the Grail castle again. This time, older and wiser, he asked the crucial question: “Whom does the Grail serve?” This simple act of compassion healed the Fisher King and the wasteland around the castle.
Parzival became the new Grail King, having learned that true knighthood wasn’t just about fighting skills, but about wisdom and understanding the needs of others.
The legend of Parzival teaches us that it’s okay to make mistakes as long as we learn from them. It shows us the importance of asking questions and never giving up on our quests, even when they seem impossible.
Python Lessons
In an attempt to keep things fun and to have a recurring theme, the lessons presented to you in this class will loosely follow the ancient legend of Parzival. The Grail in our case will be the knowledge and skills necessary to create our own video games from scratch. This is what we will be working up to as we progress through the various units of study.
Extensive class notes will be provided by me in digital format on the class website in both web and downloadable formats. These notes will provide you with explanations and examples of key concepts. You will not be expected to memorize all of the Python syntax that we cover. You will however be expected to know where to find the answer to any such questions that may arise. You will find that after using certain concepts over and over again, you will indeed remember how to structure them correctly in your programs without them throwing an error, but it will not be uncommon for you to forget certain elements. That is what this documentation is for.
Assignments
You will quickly discover that writing code that runs perfectly the first time it is executed is a rare event. You will constantly be modifying your programs so that they do not produce an error or do something you didn’t expect. This is called debugging and much of your time in here will be devoted to just that. It is safe to assume that you will spend more time debugging your code than actually writing it.
This class is all about perseverance and determination. You will have many problems set before you that you will need to find solutions to. Do not develop a negative attitude. You will find that by consulting your documentation, reading the error messages and focusing by eliminating distractions you will come to an understanding of what is actually going wrong and a solution will present itself. What absolutely will not work is staring at your screen and hoping the answer pops into your head. It won’t, no matter how hard you stare at it.
You will need to use your time wisely in this class. Since we are going to be writing real code, we need to use a real editor, which unfortunately means that you will not be able to work on the classwork outside of class on your Chromebook. The school Chromebooks are locked down in such a way that you cannot run the development environment necessary to complete the assignments. This means that all work will need to be done in class on the lab computers. If you find that you are not finishing your work in time, you will need to ensure that you are staying on task in class or attend tutorial sessions after school.
While I do not assign or require typing exercises in this particular class, the ability to type without looking at your hands will greatly speed up your ability to complete your assignments. As such, touch-typing practice is encouraged both whenever your classwork has been completed and outside of class. Programming requires typing many symbols that may be unfamiliar to even intermediate typists. For those just starting out, Typing.com is recommended and for those looking to improve their skills Monkeytype is a great resource. Both sites are free to use.
Final Thoughts
Learning to write Python programs is a challenging but rewarding experience. I chose to teach Python over other languages because it is one of the easier languages to learn while still being extremely powerful. Its concepts are also easily transferred to other languages. I do not expect everyone to continue programming after they have completed this course, but if you do, you will have real-world experience with a modern language and a professional code editor. This is real programming in every sense of the word.