Автор: Allen B. Downey
Издательство: O’Reilly Media, Inc.
Год: 2024
Страниц: 328
Язык: английский
Формат: pdf (true), epub
Размер: 10.1 MB
Python is an excellent way to get started in programming, and this clear, concise guide walks you through Python a step at a time—beginning with basic programming concepts before moving on to functions, data structures, and object-oriented design. This revised third edition reflects the growing role of large language models (LLMs) in programming and includes exercises on effective LLM prompts, testing code, and debugging skills.
With this popular hands-on guide at your side, you'll get:
A grounding in the syntax and semantics of the Python language
A clear definition of each programming concept, with emphasis on clear vocabulary
How to work with variables, statements, functions, and data structures in a logical progression
Techniques for reading and writing files and databases
A solid understanding of objects, methods, and object-oriented programming
Debugging strategies for syntax, runtime, and semantic errors
An introduction to recursion, interface design, data structures, and basic algorithms
How to use LLMs—including effective prompts, testing code, and debugging
And more
The first six chapters introduce basic elements like arithmetic, conditionals, and loops. They also introduce the most important concept in programming, functions, and a powerful way to use them, recursion. Chapters 7 and 8 introduce strings—which can represent letters, words, and sentences—and algorithms for working with them. Chapters 9 through 12 introduce Python’s core data structures—lists, dictionaries, and tuples—which are powerful tools for writing efficient programs. Chapter 12 presents algorithms for analyzing text and randomly generating new text. Algorithms like these are at the core of large language models (LLMs), so this chapter will give you an idea of how tools like ChatGPT work. Chapter 13 is about ways to store data in long-term storage—files and databases. As an exercise, you can write a program that searches a filesystem and finds duplicate files.
Chapters 14 through 17 introduce object-oriented programming (OOP), which is a way to organize programs and the data they work with. Many Python libraries are written in object-oriented style, so these chapters will help you understand their design—and define your own objects. The goal of this book is not to cover the entire Python language. Rather, I focus on a subset of the language that provides the greatest capability with the fewest concepts. Nevertheless, Python has a lot of features you can use to solve common problems efficiently. Chapter 18 presents some of these features. Finally, Chapter 19 presents my parting thoughts and suggestions for continuing your programming journey.
Who Is This Book For?
If you want to learn to program, you have come to the right place. Python is one of the best programming languages for beginners—and it is also one of the most in-demand skills. You have also come at the right time, because learning to program now is probably easier than ever. With virtual assistants like ChatGPT, you don’t have to learn alone. Throughout this book, I’ll suggest ways you can use these tools to accelerate your learning. This book is primarily for people who have never programmed before and people who have some experience in another programming language. If you have substantial experience in Python, you might find the first few chapters too slow. One of the challenges of learning to program is that you have to learn two languages: one is the programming language itself; the other is the vocabulary we use to talk about programs. If you learn only the programming language, you are likely to have problems when you need to interpret an error message, read documentation, talk to another person, or use virtual assistants. If you have done some programming, but you have not also learned this second language, I hope you find this book helpful.
Скачать Think Python: How to Think Like a Computer Scientist (3rd Edition)