Learn Python the Hard Way (3rd Edition) cover

Learn Python the Hard Way (3rd Edition)

Rating 3.9
Word count
373K words
Chapters
40
ISBN
9787115350541

Tags

Summary

Learn Python the Hard Way (3rd Edition) is a Python primer for absolute beginners by programmer and author Zed A. Shaw, translated into Chinese by Wang Weiwei and published by Posts & Telecom Press in November 2014. The book uses an exercise-driven structure: apart from the opening "Preparation" (Exercise 0), it contains 52 exercises. The first 26 cover basics such as input/output, variables, strings, and functions; the latter 26 gradually move into conditionals, loops, lists and dictionaries, modules, classes and objects, inheritance and composition, automated testing, and finally extend to complete projects such as getting input from a browser, building a simple website, and a web game. Each exercise follows much the same format: first the coding task and instructions are given, the reader types in the code, runs it, and checks the result, then completes additional exercises. The author's core claim is the "hard way"—no copying and pasting allowed; type the code character by character, deliberately make errors, then debug and fix them, so as to truly understand how a program works. The book also comes with companion videos featuring the author himself, totaling more than five hours (the first edition included a disc; later editions provide access via QR code), and ends with a command-line quick start and "Advice from an Old Programmer." Note that the book's examples are based on the Python 2 era and differ from today's mainstream Python 3; readers should choose the newer Learn Python 3 the Hard Way or adjust the syntax for Python 3 accordingly.

Editor's review

很多 Python 入门书把读者当成“来听讲的人”,这本书则把读者当成“来干活的人”。肖的做法近乎粗暴,却也有效:不许复制粘贴,逐字敲代码;不看懂就先把错犯一遍;删掉自己刚写好的行,看程序会崩在哪里,再把它修好。52个习题像52次肌肉训练,从 print 一路练到类、继承、自动化测试,最后做出一个小网站。对零基础读者来说,它最大的价值并不在于讲清某个语法点,而在于先解决“不敢动手、一报错就慌”这个初学者常见的问题。同时,它坚持在命令行与纯文本编辑器里写代码,不借助IDE的自动补全,这种“原始”的方式会让人对文件、路径、解释器有更实在的理解。本书的示例基于较早期的 Python 环境,虽然部分语法(如 print 语句)与 Python 3 不同,但练习方法与调试思路并不过时;追求直接可用的读者不妨选用同社的《“笨办法”学Python 3》。如果你需要一本可以“做完”的书,而非读到一半就搁下的书,它值得放进书架。

Who it's for

A good fit for

  • 完全没有编程经验、想从零开始动手学 Python 的读者
  • 学过多门教程却始终写不出程序、需要强制动手练习的人
  • 喜欢习题驱动、按部就班推进,而非先读大段理论的学习者
  • 想补上命令行、文件操作与调试基本功的转行者

Not a good fit for

  • 已有 Python 基础、想深入算法、数据分析或框架开发的人
  • 希望系统学习计算机原理与编程理论的读者
  • 只想查语法速查表、不愿逐题动手敲代码的人

Reading tips

  1. 务必关掉复制粘贴,逐字手打每一道习题的代码,并亲手制造错误再修复
  2. 按顺序推进,每完成5—6个习题回头重做一次,把附加练习当作必修而非选做
  3. 在命令行与简单文本编辑器中练习,配合作者视频理解破坏与调试代码的过程
  4. 若使用现代 Python 3 环境,遇到 print 语句等旧版语法时参考《“笨办法”学Python 3》对照修改

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Copyright Information
  2. Copyright Notice
  3. Content Summary
  4. Translator's Preface
  5. Foreword
  6. Exercise 0: Preparation
  7. Exercise 1: The First Program
  8. Exercise 2: Comments and the # Sign
  9. Exercise 3: Numbers and Math
  10. Exercise 4: Variables and Names
  11. Exercise 5: More Variables and Printing
  12. Exercise 6: Strings and Text
  13. Exercise 7: More Printing
  14. Exercise 8: Printing, Printing
  15. Exercise 9: Printing, Printing, Printing
  16. Exercise 10: What Is That?
  17. Exercise 11: Asking Questions
  18. Exercise 12: Prompting Others
  19. Exercise 13: Parameters, Unpacking, and Variables
  20. Exercise 14: Prompting and Passing
  21. Exercise 15: Reading Files
  22. Exercise 16: Reading and Writing Files
  23. Exercise 17: More File Operations
  24. Exercise 18: Names, Variables, Code, and Functions
  25. Exercise 19: Functions and Variables
  26. Exercise 20: Functions and Files
  27. Exercise 21: Functions Can Return Something
  28. Exercise 22: What Have You Learned So Far?
  29. Exercise 23: Read Some Code
  30. Exercise 24: More Practice
  31. Exercise 25: Even More Practice
  32. Exercise 26: Congratulations, You Can Take the Test Now!
  33. Exercise 27: Memorizing Logic
  34. Exercise 28: Boolean Expression Practice
  35. Exercise 29: The if Statement
  36. Exercise 30: else and if
  37. Exercise 31: Making Decisions
  38. Exercise 32: Loops and Lists
  39. Exercise 33: The while Loop
  40. Exercise 34: Accessing Elements of Lists

FAQ

这本书和《“笨办法”学Python 3》有什么区别?
本书2014年版基于较早的 Python 2 环境,部分示例使用 print 语句等旧版写法;《“笨办法”学Python 3》于2018年出版,按 Python 3.6 重写,更适应当下环境。二者练习结构与教学理念一致,新手建议优先选Python 3版。
没有编程基础能读懂吗?
可以。本书正是为零基础读者设计,从第一个 print 程序开始,每道习题都给出具体指令与说明,不预设任何编程知识;但需要读者愿意逐字录入代码并独立排错。
需要额外的视频课程吗?
不是必需。初版随书附赠光盘,内含作者亲自讲解的5个多小时视频,后续版本改为扫码在线观看。视频侧重演示如何破坏和调试代码,配合书中的习题观看效果更好。
学完这本书能达到什么水平?
完成52个习题后,通常能掌握变量、字符串、函数、列表与字典、类与对象、文件读写和基本自动化测试,并做出小型 Web 项目;距离独立开发复杂应用仍有距离,需继续学习框架与工程实践。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

More by the same author

Top rated in the same category