Code in Action: Learn Python Programming with ChatGPT cover

Code in Action: Learn Python Programming with ChatGPT

Rating 3.7
Word count
155K words
Chapters
108
ISBN
9787301346198

Tags

Summary

This book has 15 chapters. Chapter 1 explains what ChatGPT can do and how it helps in learning programming; Chapter 2 covers the characteristics of Python and how to set up a development environment; Chapters 3–10 cover Python fundamentals, including input and output, variables and types, operators, control flow, functions, lists, dictionaries, and modules; Chapters 11–13 introduce file operations, web scraping, and object-oriented programming in Python; Chapters 14–15 cover using ChatGPT in programming, including AI-assisted development and integrating ChatGPT into programs.

Editor's review

This is an introductory book that embeds ChatGPT throughout the entire Python learning process. Its 15 chapters are clearly structured: it first explains what ChatGPT can do and how it helps in learning programming, then sets up the Python development environment, and proceeds to cover language fundamentals such as input/output, variable types, operators, control flow, functions, lists, dictionaries, and modules, before moving on to file operations, web scraping, and object-oriented programming. The final two chapters focus on using ChatGPT for assisted development and integrating ChatGPT into programs. Its strength lies in running two tracks side by side—learning to program and using AI to learn programming—so readers build a Python foundation while also developing the habit of using AI to troubleshoot and understand code. It suits beginners with no prior experience who want to learn by doing, as well as readers with programming experience who want a quick understanding of how to bring ChatGPT into their development workflow. The key is not to just read without typing: run every example in each chapter yourself and try asking ChatGPT to explain or rewrite it.

Who it's for

A good fit for

  • Programming beginners with no prior experience who want to learn Python with AI-assisted Q&A
  • Students who need a complete, clearly structured introductory Python textbook
  • Experienced programmers who want to learn how to use ChatGPT for assisted development and integrate it into programs
  • Self-taught learners who want to build the habit of using AI to troubleshoot code

Not a good fit for

  • Advanced readers with a solid Python background who want to go deeper into algorithms or engineering architecture
  • Readers looking for a systematic treatment of data structures and algorithm theory
  • Readers who only want to understand ChatGPT's product features and do not intend to learn programming

Reading tips

  1. Study the chapters in order, type out every code example yourself, and when you hit an error, troubleshoot it yourself before asking ChatGPT.
  2. After finishing, use ChatGPT to restate each chapter's key points and generate practice questions to check your understanding.
  3. Use Chapters 14 and 15 to practice with small real projects, integrating ChatGPT into your own scripts to experience collaborative development.

About the publisher

Peking University Press China · Founded in 1979

Peking University Press is a comprehensive university press whose publishing areas cover classical literature, popular science, social culture, world history, Western philosophy, and culture. Its catalogue contains 6,031 titles, with representative books including A Dream of Red Mansions, Relativity: The Special and General Theory (15th Edition) (with Einstein's classic papers on unified field theory and other topics), Elements, Conics, The Aristocratic Families of the Eastern Jin, The Philosophy of Mythology (Volume I), The Philosophy of Mythology (Volume II), and The Origin of Continents and Oceans. Representative authors include Cao Xueqin, Zhou Ruchang, Albert Einstein, Euclid, Apollonius, Tian Yuqing, Schelling, and Xian Gang. The press has developed distinctive strengths in classical Chinese literature and in the translation of Western philosophical classics, while also covering scientific classics and social and cultural studies. As public information is limited, this description is based only on the books in the catalogue and offers no further extrapolation.

Contents

  1. 版权信息
  2. 内容提要
  3. 前言
  4. 第1章 快速上手ChatGPT
  5. 1.1 ChatGPT的自我介绍
  6. 1.2 用ChatGPT学Python
  7. 本章小结
  8. 第2章 搭建Python开发环境
  9. 2.1 ChatGPT讲解知识点——Python快速入门
  10. 2.2 Python环境搭建
  11. 2.3 ChatGPT答疑解惑
  12. 本章小结
  13. 第3章 输入与输出
  14. 3.1 ChatGPT讲解知识点——Python基础概念
  15. 3.2 输入输出
  16. 3.3 ChatGPT答疑解惑
  17. 本章小结
  18. 第4章 变量与数据类型
  19. 4.1 ChatGPT讲解知识点——变量
  20. 4.2 变量的使用
  21. 4.3 ChatGPT讲解知识点——数据类型
  22. 4.4 Python基本数据类型
  23. 4.5 ChatGPT答疑解惑
  24. 本章小结
  25. 第5章 运算
  26. 5.1 ChatGPT讲解知识点——运算符
  27. 5.2 算术运算符
  28. 5.3 赋值运算符
  29. 5.4 比较运算符
  30. 5.5 逻辑运算符
  31. 5.6 位运算符
  32. 5.7 成员运算符
  33. 5.8 身份运算符
  34. 5.9 ChatGPT演示代码——计算BMI
  35. 5.10 ChatGPT答疑解惑
  36. 本章小结
  37. 第6章 控制流
  38. 6.1 ChatGPT讲解知识点——控制流
  39. 6.2 条件判断
  40. 6.3 ChatGPT演示代码——计算BMI升级版
  41. 6.4 循环
  42. 6.5 控制流的嵌套
  43. 6.6 ChatGPT演示代码——猜数字游戏
  44. 6.7 ChatGPT答疑解惑
  45. 本章小结
  46. 第7章 函数
  47. 7.1 ChatGPT讲解知识点——函数
  48. 7.2 函数的使用
  49. 7.3 函数的参数
  50. 7.4 ChatGPT讲解知识点——匿名函数
  51. 7.5 变量的作用域
  52. 7.6 ChatGPT演示代码——绘制字符方阵
  53. 7.7 ChatGPT答疑解惑
  54. 本章小结
  55. 第8章 列表
  56. 8.1 ChatGPT讲解知识点——列表
  57. 8.2 列表的常用操作
  58. 8.3 ChatGPT讲解知识点——列表解析式
  59. 8.4 ChatGPT讲解知识点——字符串与列表
  60. 8.5 ChatGPT演示代码——购物清单
  61. 8.6 ChatGPT答疑解惑
  62. 本章小结
  63. 第9章 字典
  64. 9.1 ChatGPT讲解知识点——字典
  65. 9.2 字典的常用操作
  66. 9.3 ChatGPT讲解知识点——del语句
  67. 9.4 ChatGPT讲解知识点——其他复合数据类型
  68. 9.5 ChatGPT演示代码——小说中的词频统计
  69. 9.6 ChatGPT答疑解惑
  70. 本章小结
  71. 第10章 模块
  72. 10.1 ChatGPT讲解知识点——模块
  73. 10.2 用ChatGPT学Python标准库
  74. 10.3 用ChatGPT学第三方模块
  75. 10.4 ChatGPT演示代码——绘制爱心图案
  76. 10.5 ChatGPT演示代码——一元二次方程计算器
  77. 10.6 ChatGPT答疑解惑
  78. 本章小结
  79. 第11章 文件操作
  80. 11.1 ChatGPT讲解知识点——文件读写
  81. 11.2 用ChatGPT学其他类型文件的读写
  82. 11.3 文件系统操作
  83. 11.4 ChatGPT演示代码——批量文件搜索器
  84. 11.5 ChatGPT答疑解惑
  85. 本章小结
  86. 第12章 网络爬虫
  87. 12.1 ChatGPT讲解知识点——网络爬虫
  88. 12.2 用ChatGPT学网页前端基础知识
  89. 12.3 requests模块
  90. 12.4 bs4模块
  91. 12.5 ChatGPT演示代码——下载Bing每日一图
  92. 12.6 ChatGPT答疑解惑
  93. 本章小结
  94. 第13章 面向对象
  95. 13.1 ChatGPT讲解知识点——面向对象
  96. 13.2 Python中的面向对象
  97. 13.3 ChatGPT演示代码——MOBA游戏角色设计
  98. 13.4 ChatGPT答疑解惑
  99. 本章小结
  100. 第14章 利用ChatGPT辅助开发
  101. 14.1 ChatGPT讲解知识点——数据分析
  102. 14.2 ChatGPT开发实例——学生成绩排名及分布
  103. 本章小结
  104. 第15章 在程序中接入ChatGPT
  105. 15.1 OpenAI API
  106. 15.2 ChatGPT接入实例——智能问答小工具
  107. 15.3 为ChatGPT提供知识库
  108. 本章小结

FAQ

I have never programmed before. Can I keep up?
The book starts with setting up the development environment and language fundamentals, and progresses step by step, so it is suitable for beginners with no prior experience. But programming requires hands-on practice; reading without writing makes it hard to master, so run every chapter's code yourself.
What exactly does the book mean by ChatGPT-assisted programming?
It mainly covers using ChatGPT to explain code, troubleshoot errors, and generate examples, as well as calling the ChatGPT API in programs to implement features. Chapters 14 and 15 focus on these applications.
What level will I reach after finishing?
You will master basic Python syntax, file operations, simple web scraping, and object-oriented programming, and be able to use ChatGPT for assisted development. Reaching an engineering-level standard still requires further project practice and deeper study.
Does the web scraping section require any extra background?
The web scraping chapters build on the earlier chapters on lists, dictionaries, modules, and file operations, so you can understand them by studying in order. Skipping the fundamentals and going straight to the web scraping section may be difficult.

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.

About the author

袁昕 Author

Yuan Xin is an author about whom little public information is available. Judging from the four works listed in the library, their writing centers on two areas: programming education and research on the elderly care industry. In the programming books, Yuan Xin uses “Code in Action” as the series title to introduce Python to beginners and incorporates ChatGPT as an aid, covering practical scenarios such as using Python and ChatGPT to handle Excel data analysis efficiently. The writing emphasizes hands-on operation and beginner guidance, highlighting how new tools can lower the learning threshold and improve office efficiency. In the social sciences, Yuan Xin contributed to a research report on the development of the elderly care industry, focusing on happy aging in the context of a Healthy China and showing attention to real-world industry and public policy. Overall, the works combine technology popularization with social issues and are aimed at beginners and readers interested in the elderly care industry.

More by the same author

Top rated in the same category