Python for Everybody

by Chuck Severance

Writing programs (or programming) is a very creative and rewarding activity. You can write programs for many reasons, ranging from making your living to solving a difficult data analysis problem to having fun to helping someone else solve a problem. This book assumes that everyone needs to know how to program, and that once you know how to program you will figure out what you want to do with your newfound skills.

Description from LibreTexts.

Publisher
University of Michigan
Subjects
Engineering, Computer Science
Licence
CC BY-NC-SA 4.0, as LibreTexts states it. Non-commercial use only.
Who can read
Tweens profiles and older, judged from its title and subjects

Contents

LibreTexts writes equations in TeX, and here they show as TeX; the PDF has them typeset.

  1. Front Matter
  2. TitlePage
  3. InfoPage
  4. Table of Contents
  5. Licensing
  6. 1: Introduction
  7. 1.1: Why should you learn to write programs?
  8. 1.2: Creativity and Motivation
  9. 1.3: Computer Hardware Architecture
  10. 1.4: Understanding Programming
  11. 1.5: Words and Sentences
  12. 1.6: Conversing with Python
  13. 1.7: Terminology - Interpreter and Compiler
  14. 1.8: Writing a Program
  15. 1.9: What is a program?
  16. 1.E: Introduction (Exercises)
  17. 1.G: Introduction (Glossary)
  18. 1.10: The Building Blocks of Programs
  19. 1.11: What could possibly go wrong?
  20. 1.12: The Learning Journey
  21. 2: Variables, Expressions, and Statements
  22. 2.1: Values and Types
  23. 2.2: Variables
  24. 2.3: Variable names and Keywords
  25. 2.4: Statements
  26. 2.5: Operators and Operands
  27. 2.6: Expressions
  28. 2.7: Order of Operations
  29. 2.8: Modulus Operator
  30. 2.9: String Operations
  31. 2.E: Variables, Expressions, and Statements (Exercises)
  32. 2.G: Glossary
  33. 2.10: Asking the user for input
  34. 2.11: Comments
  35. 2.12: Choosing Mnemonic Variable Names
  36. 2.13: Debugging
  37. 3: Conditional Execution
  38. 3.1: Boolean Expressions
  39. 3.2: Logical Operators
  40. 3.3: Conditional Execution
  41. 3.4: Alternative Execution
  42. 3.5: Chained Conditionals
  43. 3.6: Nested Conditionals
  44. 3.7: Catching exceptions Using Try and Except
  45. 3.8: Short-Circuit Evaluation of Logical Expressions
  46. 3.9: Debugging
  47. 3.E: Conditional Execution (Exercises)
  48. 3.G: Conditional Execution (Glossary)
  49. 4: Functions
  50. 4.1: Function Calls
  51. 4.2: Built-in Functions
  52. 4.3: Type Conversion Functions
  53. 4.4: Random Numbers
  54. 4.5: Math Functions
  55. 4.6: Adding New Functions
  56. 4.7: Definitions and Uses
  57. 4.8: Flow of Execution
  58. 4.9: Parameters and Arguments
  59. 4.E: Functions (Exercises)
  60. 4.G: Functions (Glossary)
  61. 4.10: Fruitful functions and void functions
  62. 4.11: Why functions?
  63. 4.12: Debugging
  64. 5: Iterations
  65. 5.1: Updating Variables
  66. 5.2: The while Statement
  67. 5.3: Infinite Loops
  68. 5.4: "Infinite loops" and break
  69. 5.5: Finishing iterations with continue
  70. 5.6: Definite loops using for
  71. 5.7: Loop patterns
  72. 5.8: Counting and Summing Loops
  73. 5.9: Maximum and Minimum Loops
  74. 5.E: Iterations (Exercises)
  75. 5.G: Iterations (Glossary)
  76. 5.10: Debugging
  77. 6: Strings
  78. 6.1: A string is a sequence
  79. 6.2: Getting the length of a string using len
  80. 6.3: Traversal through a string with a loop
  81. 6.4: String Slices
  82. 6.5: Strings are immutable
  83. 6.6: Looping and Counting
  84. 6.7: The in operator
  85. 6.8: String Comparison
  86. 6.9: String Methods
  87. 6.E: Strings (Exercises)
  88. 6.G: Strings (Glossary)
  89. 6.10: Parsing strings
  90. 6.11: Format operator
  91. 6.12: Debugging
  92. 7: Files
  93. 7.1: Persistence
  94. 7.2: Opening Files
  95. 7.3: Text files and Lines
  96. 7.4: Reading Files
  97. 7.5: Searching through a File
  98. 7.6: Letting the user choose the file name
  99. 7.7: Using try, except, and open
  100. 7.8: Writing Files
  101. 7.9: Debugging
  102. 7.E: Files (Exercises)
  103. 7.G: Files (Glossary)
  104. 8: Lists
  105. 8.1: A list is a sequence
  106. 8.2: Lists are mutable
  107. 8.3: Traversing a List
  108. 8.4: List operations
  109. 8.5: List Slices
  110. 8.6: List Methods
  111. 8.7: Deleting Elements
  112. 8.8: Lists and Functions
  113. 8.9: Lists and Strings
  114. 8.E: Lists (Exercises)
  115. 8.G: Lists (Glossary)
  116. 8.10: Parsing lines
  117. 8.11: Objects and Values
  118. 8.12: Aliasing
  119. 8.13: List arguments
  120. 8.14: Debugging
  121. 9: Dictionaries
  122. 9.1: Dictionaries
  123. 9.2: Dictionary as a Set of Counters
  124. 9.3: Dictionaries and Files
  125. 9.4: Looping and Dictionaries
  126. 9.5: Advanced Text Parsing
  127. 9.6: Debugging
  128. 9.E: Dictionaries (Exercises)
  129. 9.G: Dictionaries (Glossary)
  130. 10: Tuples
  131. 10.1: Tuples are Immutable
  132. 10.2: Comparing Tuples
  133. 10.3: Tuple Assignment
  134. 10.4: Dictionaries and Tuples
  135. 10.5: Multiple assignment with dictionaries
  136. 10.6: The most common words
  137. 10.7: Using Tuples as Keys in Dictionaries
  138. 10.8: Sequences- strings, lists, and tuples - Oh My!
  139. 10.9: Debugging
  140. 10.E: Tuples (Exercises)
  141. 10.G: Tuples (Glossary)
  142. 11: Regular Expressions
  143. 11.1: Regular Expressions
  144. 11.2: Character matching in regular expressions
  145. 11.3: Extracting data using regular expressions
  146. 11.4: Combining searching and extracting
  147. 11.5: Escape Character
  148. 11.6: Bonus section for Unix / Linux users
  149. 11.7: Debugging
  150. 11.E: Regular Expressions (Exercises)
  151. 11.G: Regular Expressions (Glossary)
  152. 11.S: Regular Expressions (Summary)
  153. 12: Networked Programs
  154. 12.1: HyperText Transfer Protocol - HTTP
  155. 12.2: The World's Simplest Web Browser
  156. 12.3: Retrieving an image over HTTP
  157. 12.4: Retrieving web pages with urllib
  158. 12.5: Parsing HTML and scraping the web
  159. 12.6: Parsing HTML using regular expressions
  160. 12.7: Parsing HTML using BeautifulSoup
  161. 12.8: Reading binary files using urllib
  162. 12.E: Networked Programs (Exercises)
  163. 12.G: Networked Programs (Glossary)
  164. 13: Python and Web Services
  165. 13.1: eXtensible Markup Language - XML
  166. 13.2: Looping through Nodes
  167. 13.3: JavaScript Object Notation - JSON
  168. 13.4: Parsing JSON
  169. 13.5: Application Programming Interfaces
  170. 13.6: Google geocoding web service
  171. 13.7: Security and API usage
  172. 13.E: Python and Web Services (Exercises)
  173. 13.G: Python and Web Services (Glossary)
  174. 14: Object-Oriented Programming
  175. 14.1: Managing Larger Programs
  176. 14.2: Getting Started
  177. 14.3: Using Objects
  178. 14.4: Starting with Programs
  179. 14.5: Subdividing a Problem - Encapsulation
  180. 14.6: Our First Python Object
  181. 14.7: Classes as Types
  182. 14.8: Many Instances
  183. 14.9: Object Lifecycle
  184. 14.G: Object-Oriented Programming (Glossary)
  185. 14.S: Object-Oriented Programming (Summary)
  186. 14.10: Inheritance
  187. 15: Using Databases and SQL
  188. 15.1: What is a database?
  189. 15.2: Database Concepts
  190. 15.3: Database Browser for SQLite
  191. 15.4: Creating a database table
  192. 15.5: Structured Query Language summary
  193. 15.6: Spidering Twitter using a database
  194. 15.7: Basic data modeling
  195. 15.8: Programming with Multiple Tables
  196. 15.9: Constraints in Database Tables
  197. 15.G: Using Databases and SQL (Glossary)
  198. 15.S: Using Databases and SQL (Summary)
  199. 15.10: Retrieve and/or insert a record
  200. 15.11: Storing the friend relationship
  201. 15.12: Three Kinds of Keys
  202. 15.13: Using JOIN to retrieve data
  203. 15.14: Degugging
  204. 16: Visualizing data
  205. 16.1: Building a Google map from geocoded data
  206. 16.2: Visualizing Networks and Interconnections
  207. 16.3: Visualizing mail data
  208. Back Matter
  209. Index
  210. Glossary
  211. Detailed Licensing