Python Coding Cookbook

Python Coding Cookbook cover

A complete Python reference for Year 10–13 learners taking Cambridge IGCSE and A Level Computer Science, and for the teachers who teach them. It assumes no programming experience: Chapter 1 starts from the very first program, and the last chapters cover the A Level topics tested in the practical exam.

Book details

  • Pages: 242
  • Chapters: 33
  • Level: Year 10–13
  • Curriculum: Cambridge IGCSE and AS & A Level
  • Formats: print-ready PDF, EPUB and digital PDF

Who it is for

In South Africa, Python is examined by Cambridge International. The book follows both Cambridge Computer Science syllabuses:

  • Cambridge IGCSE Computer Science (0478), Years 10 and 11. Both papers are written, with algorithms in Cambridge pseudocode, so Python is how learners practise. Parts 1 to 5 cover this course.
  • Cambridge AS & A Level Computer Science (9618), Years 12 and 13. Paper 2 is a written problem-solving paper; Paper 4 is a practical exam on a computer, which can be written in Python. Parts 1 to 7 cover this course.

What the book covers

33 chapters in seven parts, three appendices and a glossary.

PartChaptersWhat it coversMost useful for
1. The basics1–10Getting started, data types, variables, input and output, operators, strings, conditions, selection, loops and random numbersEveryone
2. Data structures11–14Lists, 2D lists, tuples, sets, dictionaries and recordsIGCSE and AS
3. Organising code15–19Functions, modules, errors and exceptions, validation and recursionEveryone; exceptions and recursion are A Level topics
4. Algorithms20Linear and binary search, bubble and insertion sortIGCSE, AS and A Level
5. Files, data and dates21–25Text files, CSV files, databases with SQLite, SQL, dates and timesIGCSE (files and SQL) and AS
6. Object-oriented programming26–30Classes, encapsulation, special methods, inheritance, polymorphism and aggregationA Level
7. Abstract data types31–33Stacks, queues, linked lists and binary treesAS (the ideas) and A Level
  • Appendix A: error messages, finding bugs, the debugger and good style (PEP 8).
  • Appendix B: Cambridge pseudocode translated into Python and back, for the written papers.
  • Appendix C: an optional introduction to graphical interfaces with tkinter.
  • Glossary: every technical term in plain language.

How each chapter works

  1. Introduction: what the topic is and why it matters.
  2. Numbered sections: one idea at a time, with code to type in and run, and the output it prints.
  3. Worked examples: small, complete programs that bring the ideas together.
  4. Common mistakes: the errors learners make most often, what goes wrong and how to fix it.
  5. Check yourself: short questions with the answers straight after them.

The book also includes a guide for teachers on planning, classroom activities and practical work, a guide for learners on study habits and exam preparation, and suggested routes through the book.

Software

Python 3.10 or later with IDLE, VS Code or Thonny, using console programs as in the exams. Python includes everything the book uses, including SQLite for databases, so nothing else needs installing. Every example has been run, with its output shown underneath.

Practice data pack

  • Text and CSV files for the file-handling chapters
  • school.db, an SQLite database that matches the SQL chapters
  • Extra practice files and a second database, with a list of practice tasks

Your school’s edition

Your school badge goes on the cover, and you receive the Python Coding Cookbook as a print-ready PDF, an EPUB and a digital PDF, with the practice data pack. Your licence lets you print, share and resell the book to your own learners. See how licensing works.

Scroll to top