In many ways, learning a programming language is like learning a foreign (human) language. You can take a course, understand the subject, and even do well on the final exam. But when it comes time to actually use the language, you can find yourself flustered, unsure of just what syntax to use, or what’s the most appropriate way to phrase something—let alone be unable to understand native speakers.
That’s where practice comes in. Practicing a foreign language gives you greater fluency and confidence, allowing you to engage in deeper and more interesting conversations. Practicing Python allows you to solve problems more quickly and easily, while simultaneously writing more readable and maintainable code. The improvement happens over time, as you use the language in new and varied situations. It often isn’t obvious that you have improved. And yet, when you look back to how you were using the language just a few months before, the difference is stark.
This book isn’t meant to teach you Python. Rather, it’s meant to give you the practice you need to achieve greater fluency. After going through the exercises in this book—not just skimming through the questions and peeking at the answers—you will write more readable, more idiomatic, and more maintainable Python code.
Python Workout is the result of conversations with students in my corporate Python training classes. Once the course was over, they often asked where they could get additional practice, to continue improving their skills. This book draws upon the hands-on labs that I give my students, as well as discussions that I have had with them during and after class.
The exercises are designed to help you internalize some of the core ideas in Python: core data structures, functions, comprehensions, object-oriented programming, and iterators. These might seem like simple topics, perhaps even too simple for a book of exercises. But all of Python, from the largest application to the smallest script, is based on these building blocks. Knowing them well is a crucial part of being a fluent Python developer. I often say that ignoring these building blocks in favor of more complex topics is akin to a chemistry student ignoring the elements in favor of “real” chemicals.
I can personally attest to the power of practice, not just as a Python instructor, but also as a student. For several years, I’ve been learning Chinese, in no small part because I travel to China every few months to teach Python courses there. Each lesson that I take, and every exercise that I do, doesn’t seem to advance my fluency very much. But when I return to China after an absence of several months, I find that the practice has indeed helped, and that I’m able to communicate more easily with the locals.
I’m still far from fluent in Chinese, but I’m making progress, and I delight in looking back and seeing how far I’ve come. I hope and expect that Python Workout will do the same for you, advancing your understanding and fluency with each passing day.
Если вам понравилась эта книга поделитесь ею с друзьями, тем самым вы помогаете нам развиваться и добавлять всё больше интересных и нужным вам книг!