Conceptual Programming with Python


Thorsten and Isaac have written this book based on a programming course we teach for Master’s Students at the School of Computer Science of the University of Nottingham. The book is intended for students with little or no background in programming coming from different backgrounds educationally as well as culturally. It is not mainly a Python course but we use Python as a vehicle to teach basic programming concepts. Hence, the words conceptual programming in the title.

Content

We cover basic concepts about data structures, imperative programming, recursion and backtracking, object-oriented programming, functional programming, game development and some basics of data science.

View a sample » Videos »

The Book

1st Edition Thorsten Altenkirch and Isaac Triguero, University of Nottingham.
Self-published on Lulu.com,
30th September 2019,
Paperback: ISBN 978-0-244-82276-7;
260 pages

Paperback » eBook »

About us

Thorsten Altenkirch (also known as Der Chef) and Isaac Triguero (also known as El Jefe) are with the School of Computer Science of the University of Nottingham.

More »


Overview of the book

We start with an exploration of Python from the top-level (Chapter 2), which covers some basic concepts like data types, coercions, functions and so on. We also introduce a graphical view of data structures in Python. Next we look at imperative programming (Chapter 3) which is the traditional way of programming present in Fortran or C. We introduce basic control structures like if-then-else and loops. We also discuss Turing's famous Halting problem. After this, we introduce one of the most powerful spells the young software wizard should master: recursion (Chapter 4), that is a function that calls itself. We are also using this to implement a sudoku solver via backtracking. Obviously, we cover Object Oriented Programming (Chapter 5) which is now a standard approach to program development. We also explain the use of trees to represent expressions and knowledge bases. An alternative to Object Oriented Programming is Functional Programming (Chapter 6), which is close to a mathematical understanding of programming. We also cover infinite data structures and how to write a Python interpreter in a functional style. Now you need to develop a bigger program, ideally in a group, and we suggest to write a game because it is fun and it is easy to understand what the goal is, hence we introduce the pygame library (Chapter 7). Finally, we give an introduction to Data Science which underlies the modern approach to Machine Learning (Chapter 8).

We present some challenges during the text, which you should try to solve yourself, but our solution is provided at the end of the chapter. Each chapter finishes with a quiz and exercises. The quiz can be easily done by using the Python interpreter but the point is to see whether you understand the language well enough to execute programs in your head. Indeed, the ability to run programs in your head is essential if you want to be able to write programs. The exercises are of different degrees of difficulty.

Content

1  Introduction
 1.1  Why Python?
 1.2  How to use Python?
 1.3  Where to find more information?
 1.4  Overview over the book
 1.5  About the authors
2  Python from the top-level
 2.1  Basic types and operations
 2.2  Data structures
 2.3  Mysteries of Python
 2.4  Summary
 2.5  Solution to top-level challenge
 2.6  Quiz
 2.7  Exercises
3  Imperative Programming
 3.1  Blocks of Code
 3.2  Inputs/Outputs
 3.3  Error handling
 3.4  Loops
 3.5  The Halting problem
 3.6   Iterating through data structures
 3.7   The guessing game
 3.8  Summary
 3.9  Solution to Challenges
 3.10  Quizzes
 3.11  Exercises
4  Recursion and backtracking
 4.1  Prelude: functions calling functions
 4.2  The Towers of Hanoi
 4.3  How is recursion executed?
 4.4  Some combinatorics
 4.5  Solving sudoku: Using backtracking
 4.6  Summary
 4.7  Solution to recursion challenge
 4.8  Quizzes
 4.9  Exercises
5  Object Oriented Programming
 5.1  First example: a class to handle accounts
 5.2  OOP example 1: Implementing Expressions
 5.3  OOP example 2: Creating a Knowledge Base
 5.4  Summary
 5.5  Solution to oop challenge
 5.6  Quizzes
 5.7  Exercises
6  Functional Programming
 6.1  Higher order functions and comprehension
 6.2  Laziness
 6.3  The sieve of Erathostenes
 6.4  Python in Python
 6.5  Summary
 6.6  Solution to challenge
 6.7  Quizzes
 6.8  Exercises
7  Implementing games with pygame
 7.1  What is Pygame?
 7.2  The Pong Game
 7.3  Software Engineering
8  Getting started with Data Science
 8.1  Data analysis with the Pandas library
 8.2  Visualising your data
 8.3  Mining the data
 8.4  Summary
 8.5  Solutions to Challenges
 8.6  Exercises

Videos

We are making some videos associated to the different chapters of our book. These are available on the Computerphile channel.


Feedback

From Lulu

"Excellent book! Highly recommended. This is the main textbook of a module I'm currently teaching." By
Ahmed Kheiri, Lecturer in Management Science at Lancaster University (United Kingdom), 14-Jan-2020

"I really enjoyed reading this book. With its colloquial style, it is easy to follow and a pleasure to read. I can imagine that it is well suited for early programmers and definitely has some insights even for seasoned coders. Examples and problems presented are interesting and refreshing - you want to try them out. After all, who does not want to impress their elders by having their Python code solve the most difficult Sudoku? At first, I was surprised not to find all code on Github. However, just as the authors say that reading code is important, I think writing code, even if it is copying out of this book, is a useful next step. Off to finish my Pygame Pong implementation!" By Yves 29-Dec-2019

This book is very informative and at a level of everybody. It is touched the most important concepts of programming. Moreover, it has challenging exercises to help you cemented a concept learnt on each chapter. It is easy to follow even for a person with no background in programming. It is well written and go to straight to the point. You don’t waste time with a lot of literature which don’t matter to the learning. I will highly recommend this book to anybody who wants to learn concepts of programming, not just programming syntax. By RAOUL NIYO 28-Dec-2019

Instructors

Course instructors can request an inspection copy of the book, together with a large collection of introductory and advanced exams and answers based on the content.


About us



Isaac was born and bred in a small town, called Atarfe, in the region of the magnificent Granada, Spain, where the emblematic Arabic palace and fortress 'Alhambra' sits. Unfortunately, he can't tell the Alhambra was built for him -- and luckily it was not demolished after his departure --, but he can undoubtedly say that it is way more beautiful than that Wall from Germany. Isaac studied his MSc and PhD degrees in Computer Science at the University of Granada, where he was drawn into all the buzz words of the moment (Data science and Big data) before departing to Ghent where he worked (and mostly ate waffles on a daily basis) as a postdoctoral researcher. A few years ago, Isaac joined the School of Computer Science at the University of Nottingham, and he was soon severely punished and trapped into teaching this programming course with the inimitable Thorsten. As a ''junior'' professor, working with the old and wise Der Chef and his bold teaching style has been a real challenge for him, but it turned to be a very rewarding experience, in which they ended up teaching each other quite a few things.
logo


Thorsten and Isaac have mostly written this book together, but they led different chapters; you are challenged to guess who wrote what...

Contact us: Isaac, Thorsten