The Python Workbook: A Brief Introduction with Exercises and Solutions

Front Cover
Springer, Jan 22, 2015 - Computers - 165 pages

While other textbooks devote their pages to explaining introductory programming concepts, The Python Workbook focuses exclusively on exercises, following the philosophy that computer programming is a skill best learned through experience and practice.

Designed to support and encourage hands-on learning about programming, this student-friendly work contains 174 exercises, spanning a variety of academic disciplines and everyday situations. Solutions to selected exercises are also provided, supported by brief annotations that explain the technique used to solve the problem, or highlight specific points of Python syntax. No background knowledge is required to solve the exercises, beyond the material covered in a typical introductory Python programming course.

Features: uses an accessible writing style and easy-to-follow structure; includes a mixture of classic exercises from the fields of computer science and mathematics, along with exercises that connect to other academic disciplines; presents the solutions to approximately half of the exercises; provides annotations alongside the solutions, which explain the approach taken to solve the problem and relevant aspects of Python syntax; offers a variety of exercises of different lengths and difficulties; contains exercises that help the development of programming skills using if statements, loops, basic functions, lists, dictionaries, files, and recursive functions.

Undergraduate students undergoing their first programming course and wishing to enhance their programming abilities will find the exercises and solutions provided in this book to be ideal for their needs.


What people are saying - Write a review

User Review - Flag as inappropriate

Python is a very popular and very powerful modern programing language. In terms of its syntax and style it might be one of the “cleanest” programming languages out there. Yet, its deceptively simple code often belies the underlining power and efficiency. In terms of professional development, knowledge of Python is right now probably one of the most sought out technical skills. Learning Python is very learning for many technical professions, and this small books is a very useful resource to have for exactly such purpose.
The best way to learn any new skill is to do a lot of exercises and solve a lot of problems. This workbook provides 174 relatively straightforward excises that cover most important programming topics. The exercises are dived into eight different sections, such as “Loop Exercises,” “Dictionary Exercises,” “Recursion Exercises,” etc. The statement of the exercises/problems is very clear and well explained, and it’s usually covered in one or two paragraphs. The exercises also state if they are solved or not, and how long in terms of lines of program the solutions are.
As is to be expected from an workbook of this kind, many of the exercises come with a solution that is provided at the back of the book. The solutions are very to the point and concise, with a minimal amount of comments and explanations. Comments are given in the form of commented-out lines of code, while the short explanations are given on the side in grey boxed areas. All the code is properly and cleanly formatted. It is also color coded, which is a nice bonus and greatly helps with readability.
The content and the difficulty level of this book are both very accessible. The book is suitable for a gentle introductory college level course, or even a solid high school intro to programming course. None of the exercises require more than a few dozen lines of code to implement, and thus are not too demanding on your time and effort. A book like this one might in fact be ideal for someone aiming to learn programming or Python on his own. It can also be a very good supplementary material for an online course, which is in fact how I have been mostly using it. After a few weeks of going through these exercises I find that my Python fluency has greatly increased, and I am able to think in Pythonese and code much more efficiently. The book is a great resource for acquiring the basic coding fluency, but for more advanced programming skills you will need a more substantial reference.


1 Introduction to Programming Exercises
2 If Statement Exercises
3 Loop Exercises
4 Function Exercises
5 List Exercises
6 Dictionary Exercises
7 File and Exception Exercises
8 Recursion Exercises
10 If Statement Solutions
11 Loop Solutions
12 Function Solutions
13 List Solutions
14 Dictionary Solutions
15 File and Exception Solutions
16 Recursion Solutions

Part IISolutions
9 Introduction to Programming Solutions

Other editions - View all

Common terms and phrases

About the author (2015)

Dr. Ben Stephenson is a Senior Instructor in the Department of Computer Science at the University of Calgary, AB, Canada.

Bibliographic information