Learn to Code by Solving Problems

Author: Dr. Daniel Zingaro
Publisher: No Starch Press
Date: June 2021
Pages: 335
ISBN: 978-1718501324
Print: 1718501323
Kindle: B08FH92YL8
Audience: People wanting to learn Python
Rating: 4
Reviewer: Mike James
Solving problems - sounds good?


We all learn to program by solving problem but they very quckly become our problems rather than ones set to teach us programming. I have met students who asked for suggestions for something to implement to help them learn and practice the skill of programming, but in most cases they were presented with and selected problems in areas that might interest them. In the case of a book that offers you problems you either have to hope that the author has been brilliant in selecting problems that will appeal to everyone or has found enough problems to keep the reader happy.

Perhaps the most important thing to know about this book is that it is based on the programming judge websites, which are not a homogeneous group, and three specific sites are used. The idea is that you submit your code to the site, after signing up, and it runs tests and tells you if your code passes. If it does then there is a reasonable probability that your code is correct - but it doesn't tell you how good your solution is. If it fails then you know which test it failed, but this isn't much help to a beginner in finding out what is wrong. Clearly the book is restricted to problems that are supported by the three websites used.

Banner

The book covers different Python topics in each chapter. The first chapter is about getting started and covers how to use Python and the basics of the language. The first problem is to count the number of words in a string. This is quite a sophisticated problem if you really are a beginner and in my opinion not a good place to start - but you have to start somewhere. There is a lot to take in before you move to Chapter 2, which is a set of problems on the use of the if statement.- the problems are a bit contrived and aren't particularly engaging.

 

Chapters 3 and 4 are on loops and the problems are still fairly contrived and uninspiring. Chapter 5 is about lists and things aren't any more exciting. Chapter 6 moves on to functions and the problems, which focus on a card game, start to be more exciting. Chapter 7 is about files and the problems are essay formatting and farm seeding. Chapter 8 uses sets and dictionaries to implement email address processing and working out common words. Chapter 9 is about search algorithms and Chapter 10 is about efficiency and Big O characterization.

To give you an idea of the nature of the problems covered as you learn Python. this is one from the final chapter:

You have a scarf whose length is n feet, and each foot has a specific color. You also have m relatives. Each relative indicates what their desired scarf looks like by specifying the color of its first foot and last foot.

Your goal is to cut your original scarf in such a way as to produce the longest desired scarf for one of your relatives.

This is fairly typical.  While not all are quite as abstract, they are all fairly contrived in this way. They are essentially logical puzzles dressed up to look like real-world problems. They are not "real" problems you are likely to encounter in the real world. The success of this book for you depends very much on how enthusiastic you can get about such problems. It isn't a bad approach and if you like puzzles then it might suit your learning style.

There is another problem that you need to be aware of with this problem-based approach. It cannot do a good job of introducing topics in a logical order. For example, when introducing lists it doesn't deal with tuples or the larger class of sequences - these are introduced later when they crop up as part of a solution,. The order of things is very much governed by the needs of the problems and while the problems have been selected in an appropriate order this can never be optimal. Once again it all depends on what sort of learner you are and many will not suit the logical approach of a non-problem oriented book.

This book is a good example of its type. It is clear and it covers the solutions well. If you are happy about tackling a set of puzzles as a way of learning Python, you might find it a useful resource.  

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Modern Software Engineering (Addison-Wesley)

Author: David Farley
Pages: 256
ISBN: 978-0137314911
Print:0137314914
Kindle: B09GG6XKS4
Audience: Software Engineers
Rating: 3.5
Reviewer: Kay Ewbank

This book is subtitled 'doing what works to build better software faster' - does it teach you how to achieve that?



Programming Kotlin Applications (Wrox)

Author:  Brett McLaughlin
Publisher: Wrox/Wiley
Pages: 384
ISBN: 978-1119696186
Print: 1119696186
Kindle: B08QCK4982
Audience: Beginning Kotlin Programmers.
Rating: 3
Reviewer: Alex Armstrong

Kotlin applications - what applications in particular?


More Reviews

 

Last Updated ( Saturday, 13 November 2021 )