Introducing “Learn Python with Jupyter”

A free course book to develop computational thinking while learning to code

Learning a programming language is about learning a language. When learning a new language (such as French, Korean, etc.), we commonly learn two key components: a way of thinking–which is typically connected to a culture–and grammar–that is, how to arrange elements of speech (verbs, nouns, etc.) to create coherent sentences. Each aspect usually has a dedicated book. We study how to greet people, order a coffee, and ask for directions on the streets–that is, how to behave and think in that language–in course books. At the same time, we deepen and refine our grammar knowledge in grammar books, where chapters explain elements of speech providing detailed rules, list of exceptions, and short disjoint examples.

Books to learn programming languages typically follow a grammar book format. Each chapter covers a different aspect of coding grammar (such as data structures, loops, etc.) with brief examples that frequently use mathematics. Finding course books that gradually teach to think in a coding language is rare.

Learn Python with Jupyter is intended as a course book to help develop computational thinking while learning to code in Python. Similar to language course books, each chapter starts with a story (or a few long examples) to introduce a new topic, while providing context and favoring pattern memorization (Fig. 1A). In coding, stories are possible thanks to Jupyter notebooks, which allow seamless integration of narrative and code in the same file. Each story is accompanied by code pronunciation, as pronunciation affects thinking (e.g., = should be pronounced as “is assigned”, not as “equals”). Code and concepts presented in the story are then thoroughly described and definitions are highlighted in colored boxes (Fig. 1B). Learners have the possibility to elaborate on the presented topic with theoretical quizzes and exercises (True or false, Match the sentence halves, etc.) as well as coding exercises of increasing difficulty (Fig. 1C). Chapters finish with bullet-point recaps reformulating the latest concepts (Fig. 1D), and with a “More in depth session” addressing error management, good practice, and coding suggestions (Fig. 1E).

The order of topics presented in Learn Python with Jupyter supports development of computational thinking by progressing from spoken language to abstract symbols and constructs. The very first chapters (1–5) introduce strings as English words, followed by lists of strings, if/else conditions, and basic methods for list manipulation. The following chapters (6–12) explain slicing as an abstract alternative to list methods and the for loop as an automatic way to slice list elements. These chapters mark the transition from concrete to abstract thinking, after which more complex topics are explained. The remaining chapters (13–38) introduce numbers, more coding syntax and constructs (e.g., while loop, dictionaries, functions, etc.), and typical aspects of coding, such as “divide and conquer”, “debugging”, etc.

Figure 1. Chapter sections in Learn Python with Jupyter
Figure 1. Chapter sections in Learn Python with Jupyter

Learn Python with Jupyter aims at enabling absolute beginners–who have never been exposed to any programming language–to learn coding. This aim is supported by the conviction that everybody, regardless of social circumstances or gender, has the right to become digitally literate and acquire awareness of the increasingly digitalized world we live in. The book is free and is currently halfway finished. A new chapter is released on learnpythonwithjupyter.com every 4–6 weeks along with the related Jupyter notebook.