|Learn to Code by Solving Problems|
Author: Dr. Daniel Zingaro
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.
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.
|Last Updated ( Saturday, 13 November 2021 )|