This is the official book originally written by Silvio Peroni for the Computational Thinking and Programming course of the second-cycle degree in Digital Humanities and Digital Knowledge of the University of Bologna. The intent of this book was to have open and free material to provide to students to learn the basics of Computational Thinking and Code Programming in Python.
It includes several Python sources, exercises and the related keys. Each chapter starts by introducing an historic hero (either computer scientists, writers, philosophers, or computational agents) who is functional to discuss the main topic addressed in the chapter.
Also, the book is accompanied by additional material and exercises so as to improve computational thinking skills and Python programming.
Please do not hesitate to contact the author for any suggestion and comment on the book on Twitter or by email.
- Preface [PDF] [Google Docs]
-
Introduction to Computational Thinking [PDF] [Google Docs]
Historic hero: Noam Chomsky -
Algorithms [PDF] [Google Docs]
Historic hero: Ada Lovelace -
Computability [PDF] [Google Docs]
Historic hero: Alan Turing -
Programming languages [PDF] [Google Docs]
Historic hero: Grace Hopper -
Organising information: ordered structures [PDF] [Google Docs]
Historic hero: Donald Knuth -
Brute-force algorithms [PDF] [Google Docs]
Historic hero: Betty Holberton -
Organising information: unordered structures [PDF] [Google Docs]
Historic hero: Jorge Luis Borges -
Recursion [PDF] [Google Docs]
Historic hero: Douglas Hofstadter -
Divide and conquer algorithms [PDF] [Google Docs]
Historic hero: John von Neumann -
Dynamic programming algorithms [PDF] [Google Docs]
Historic hero: Leonardo da Pisa -
Organising information: trees [PDF] [Google Docs]
Historic hero: Gabriel García Márquez -
Backtracking algorithms [PDF] [Google Docs]
Historic hero: AlphaGo -
Organising information: graphs [PDF] [Google Docs]
Historic hero: Leonhard Euler -
Greedy algorithms [PDF] [Google Docs]
Historic hero: Evelyn Berezin
- None
- None
- None
- first_algorithm_empty.py, first_algorithm_no_assignments.py, first_algorithm.py
- define_functions.py, list_instructions.py, stack_instructions.py, queue_instructions.py
- stack_from_list.py, run_forever.py, linear_search.py, insertion_sort.py
- set_instructions.py, dictionary_instructions.py
- run_forever_recursive.py, multiplication.py
- immutable_values.py, mutable_values.py, immutable_and_mutable_variables.py, merge.py, merge_sort.py
- fib_dc.py, fib_dp.py
- tree_instructions.py
- peg_solitaire.py
- graph_instructions.py, multigraph_instructions.py, graph_attribute_instructions.py
- line_wrap.py
- Exercises 1, 2, 3
- Exercises 1, 2, 3
- Exercises 1, 2, 3
- Exercises 1, 2, 3
- Exercises 1, 2, 3
- Exercises 1, 2, 3, 4, 5
- Exercises 1, 2, 3
- Exercises 1, 2
- Exercises 1, 2, 3
- Exercises 1, 2
- Exercises 1, 2
- Exercises 1, 2
- Exercises 1, 2
- Exercises 1, 2
The exercises in this section focus in enhancing the two main activities that concern the learning of a new language (including a programming language), i.e. understanding something written in a certain language, and using such language to develop a new artifact. All the exercises proposed herein are split according to three distinct and increasing levels: beginner, intermediate, advanced.
The exercises of this section focus on figuring out the execution of a particular piece of Python code according to a given input. The goal is to test a user to act as an electronic computer when executing a certain Python function. All the exercises of this section are accompanied by the related executable code, which allows one to test what is the output of the functions considering the particular input one can specify through the shell.
- Beginner: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
- Intermediate: 1, 2, 3, 4, 5, 6, 7
- Advanced: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
The exercises of this section focus on creating a Python function according to a natural language description of its input, output, and behaviour. The goal is to test a user to write a program that can be interpreted by an electronic computer. All the exercises of this section are accompanied by the related executable code, which includes also the tests created as part of the test-driven development methodology introduced in chapter "Programming Language". This chapter also introduces a possible methodology to follow for the development of an algorithm as a Python function, that can be used as basis to solve the exercises in this section.
- Beginner: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21
- Intermediate: 1, 2, 3, 4, 5, 6, 7, 8
- Advanced: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
Atari Go: A DIY version of a famous variant of Go which is useful to learn the basics of the game. It is also available (and citable) on Zenodo:
Peroni, S. (2018). Atari Go. Version 1.0.1. Zenodo. https://doi.org/10.5281/zenodo.2222272
IDEA instructions: binary search: A nonverbal definition of the binary search algorithm, created by Sándor P. Fekete and Sebastian Morr. It is also available in the IDEA website.
IDEA instructions: merge sort: A nonverbal definition of the merge sort algorithm, created by Sándor P. Fekete and Sebastian Morr. It is also available in the IDEA website.
IDEA instructions: quick sort: A nonverbal definition of the quick sort algorithm, created by Sándor P. Fekete and Sebastian Morr. It is also available in the IDEA website.
Computer Science - Khan Academy: a collection of videos and material introducing several Computer Science concepts, including an entire section on algorithms.
How To Code in Python: a book written by Lisa Tagliaferri containing a series of tutorials around the Python world, available in PDF and EPUB.
Introduction to Cultural Analytics & Python: an interactive book written by Melanie Walsh which demonstrates how Python can be used to study cultural materials such as song lyrics, short stories, newspaper articles, tweets, Reddit posts, and film screenplays.
All the documents (chapters, exercises, etc.) are released under a Creative Commons Attribution 4.0 International (CC BY 4.0). For all the third party material used in any document, the license explicitly specified on such material is used.
All the software has been released with an ISC License.
All the data are released under a CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication.
The licenses mentioned above apply to all the entities unless otherwise specified. More information about the licenses are available on the GitHub repository of the book.