Book description
Easy to understand and fun to read, this updated edition of Introducing Python is ideal for beginning programmers as well as those new to the language. Author Bill Lubanovic takes you from the basics to more involved and varied topics, mixing tutorials with cookbook-style code recipes to explain concepts in Python 3. End-of-chapter exercises help you practice what you’ve learned.
You’ll gain a strong foundation in the language, including best practices for testing, debugging, code reuse, and other development tips. This book also shows you how to use Python for applications in business, science, and the arts, using various Python tools and open source packages.
Publisher resources
Table of contents
- Preface
- I. Python Basics
- 1. A Taste of Py
- 2. Data: Types, Values, Variables, and Names
- 3. Numbers
- 4. Choose with if
-
5. Text Strings
- Create with Quotes
- Create with str()
- Escape with \
- Combine by Using +
- Duplicate with *
- Get a Character with []
- Get a Substring with a Slice
- Get Length with len()
- Split with split()
- Combine by Using join()
- Substitute by Using replace()
- Strip with strip()
- Search and Select
- Case
- Alignment
- Formatting
- More String Things
- Coming Up
- Things to Do
- 6. Loop with while and for
-
7. Tuples and Lists
- Tuples
-
Lists
- Create with []
- Create or Convert with list()
- Create from a String with split()
- Get an Item by [ offset ]
- Get Items with a Slice
- Add an Item to the End with append()
- Add an Item by Offset with insert()
- Duplicate All Items with *
- Combine Lists by Using extend() or +
- Change an Item by [ offset ]
- Change Items with a Slice
- Delete an Item by Offset with del
- Delete an Item by Value with remove()
- Get an Item by Offset and Delete It with pop()
- Delete All Items with clear()
- Find an Item’s Offset by Value with index()
- Test for a Value with in
- Count Occurrences of a Value with count()
- Convert a List to a String with join()
- Reorder Items with sort() or sorted()
- Get Length with len()
- Assign with =
- Copy with copy(), list(), or a Slice
- Copy Everything with deepcopy()
- Compare Lists
- Iterate with for and in
- Iterate Multiple Sequences with zip()
- Create a List with a Comprehension
- Lists of Lists
- Tuples Versus Lists
- There Are No Tuple Comprehensions
- Coming Up
- Things to Do
-
8. Dictionaries and Sets
-
Dictionaries
- Create with {}
- Create with dict()
- Convert with dict()
- Add or Change an Item by [ key ]
- Get an Item by [key] or with get()
- Get All Keys with keys()
- Get All Values with values()
- Get All Key-Value Pairs with items()
- Get Length with len()
- Combine Dictionaries with {**a, **b}
- Combine Dictionaries with update()
- Delete an Item by Key with del
- Get an Item by Key and Delete It with pop()
- Delete All Items with clear()
- Test for a Key with in
- Assign with =
- Copy with copy()
- Copy Everything with deepcopy()
- Compare Dictionaries
- Iterate with for and in
- Dictionary Comprehensions
- Sets
- Data Structures So Far
- Make Bigger Data Structures
- Coming Up
- Things to Do
-
Dictionaries
-
9. Functions
- Define a Function with def
- Call a Function with Parentheses
- Arguments and Parameters
- Docstrings
- Functions Are First-Class Citizens
- Inner Functions
- Anonymous Functions: lambda
- Generators
- Decorators
- Namespaces and Scope
- Uses of _ and __ in Names
- Recursion
- Async Functions
- Exceptions
- Coming Up
- Things to Do
- 10. Oh Oh: Objects and Classes
- 11. Modules, Packages, and Goodies
- II. Python in Practice
- 12. Wrangle and Mangle Data
- 13. Calendars and Clocks
- 14. Files and Directories
- 15. Data in Time: Processes and Concurrency
- 16. Data in a Box: Persistent Storage
- 17. Data in Space: Networks
- 18. The Web, Untangled
- 19. Be a Pythonista
- 20. Py Art
- 21. Py at Work
- 22. Py Sci
- A. Hardware and Software for Beginning Programmers
- B. Install Python 3
- C. Something Completely Different: Async
-
D. Answers to Exercises
- 1. A Taste of Py
- 2. Data: Types, Values, Variables, and Names
- 3. Numbers
- 4. Choose with if
- 5. Text Strings
- 6. Loop with while and for
- 7. Tuples and Lists
- 8. Dictionaries
- 9. Functions
- 10. Oh Oh: Objects and Classes
- 11. Modules, Packages, and Goodies
- 12. Wrangle and Mangle Data
- 13. Calendars and Clocks
- 14. Files and Directories
- 15. Data in Time: Processes and Concurrency
- 16. Data in a Box: Persistent Storage
- 17. Data in Space: Networks
- 18. The Web, Untangled
- 19. Be a Pythonista
- 20. Py Art
- 21. Py at Work
- 22. PySci
- E. Cheat Sheets
- Index
Product information
- Title: Introducing Python, 2nd Edition
- Author(s):
- Release date: November 2019
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781492051367
You might also like
book
Head First Python, 2nd Edition
Want to learn the Python language without slogging your way through how-to manuals? With Head First …
book
Fluent Python, 2nd Edition
Don't waste time bending Python to fit patterns you've learned in other languages. Python's simplicity lets …
book
Python Crash Course, 3rd Edition
Python Crash Course is the world's best-selling guide to the Python guide programming language, with over …
book
Head First Python, 3rd Edition
What will you learn from this book? Want to learn the Python language without slogging your …