Preface
Welcome to the third volume of the book series Creative Python Programming with Strype. The books in this series form a carefully designed sequence; they can be read individually, or as a complete series, in the order in which they are presented. If you read this volume on its own, we assume that you are familiar with the programming constructs covered in the earlier volumes.
The book sequence
Books in this series build on the knowledge from the previous volume, developing deeper skills and understanding as you work along. Each book will take you through a carefully thought-out path of activities and exercises to develop your programming knowledge. If you are entirely new to programming, you should start with Volume 1. If, however, you have some prior experience, you may well choose to jump in with a later volume. The summary below gives you an idea of the level of understanding expected for each book.
Creative Python Programming with Strype
Volume 1 – Getting started with Python
The first volume starts at the very beginning. It does not assume that you know anything about Python, Strype, or indeed programming at all. It takes you from a fresh start to writing quite sophisticated programs.
The emphasis in this book is on creativity: We use a variety of graphical examples, such as an interactive game, to go through various open-ended projects that encourage you to bring in your own ideas and invent your own goals.
Through a series of carefully constructed activities, you learn many general and fundamental programming concepts and constructs: functions, variables, assignment, conditional statements and loops, data types, random behaviour and more. At the end of this book, you have worked with graphics and sound, and understand program structure, modularisation and good programming practice.
Volume 2 – Working with data
For the second volume, we assume that you are somewhat comfortable with the constructs listed above in the description of the first volume, and build up your skills from there. One important aspect that is central to the material in this book is one of the most powerful aspects of computers: the ability to work with large amounts of data.
In studying this volume, you will learn to work with data sets to process and analyse them. These can be text (such as books), or sets of numbers (such as temperature data or sound samples). You will learn a lot about using lists in Python, which is one of the central constructs to work with data.
Towards the end of this volume, we also look at graphics and sound again, and we see how the representation of data can help us to build more interesting games.
Volume 3 – Structuring data
The third volume – the one you are looking at right now – builds on the data processing of volume 2 and progresses to even more interesting projects. We learn how to use a greater variety of data structures, such as tuples and dictionaries in addition to lists, and how to combine these to model more interesting data. We do not only analyse data sources, but we also take a look at generating text, in a way a text prediction algorithm might do. In the process, we will gain a basic understanding of the inner workings of large language models (LLMs) when we write a simple version of an algorithm that is at the core of these systems.
A note for learners: How to use this book
The most important thing to realise as you work through this book to improve your programming skills – or to find out what programming can do for you – is to play along. You should concentrate on the practical exercises, get your hands on the keyboard, and write some code. You might first like to follow closely the activities we present to you, but we very much encourage you, at each step, to think about additional extensions that you may find interesting. Add your own ideas, try things out, experiment, play.
You will only become a good programmer by doing lots of programming. No amount of reading about programming will turn you into a confident programmer. Only doing it will make a difference.
This book will give you lots of information and ideas about programming projects; it is down to you to put it into practice.
Strype
We make use of the Strype environment (available at strype.org) – an online, frame-based Python development environment – for all practical exercises in this book. Strype is very tightly integrated into this text, and some projects are difficult to achieve without it.
For this volume, we assume you are familiar with editing in the Strype editor. If you are not, we recommend that you read Appendix A and B of the first volume before starting your work.
Acknowledgements
We wish to thank Pierre Weill-Tessier for his work on Strype. Pierre is a core member of the Strype development team – jointly with the authors – and has contributed key elements to the implementation of Strype. We also wish to thank Pete Dring, who has read and provided feedback on an early draft of this book. His comments helped us greatly to improve the content and structure of this work.