Phu Xuan University Library
Think Python 2ed.

External

Think Python 2ed.

Think Python is an introduction to Python programming for beginners. It starts with basic concepts of programming, and is carefully designed to define all terms when they are first used and to develop each new concept in a logical progression. Larger pieces, like recursion and object-oriented programming are divided into a sequence of smaller steps and introduced over the course of several chapters.

Author
Allen B. Downey
Publisher
Olin College
Source
LibreTexts
License
CC BY-NC
Language
EN
Category
Information Technology
Contents· 239 sections
  1. 01: The way of the program
  2. 1.01: What is a program
  3. 1.02: Running Python
  4. 1.03: The first program
  5. 1.04: Arithmetic operators
  6. 1.05: Values and types
  7. 1.06: Formal and natural languages
  8. 1.07: Debugging
  9. 1.08: Glossary
  10. 1.09: Exercises
  11. 02: Variables expressions and statements
  12. 2.01: Assignment statements
  13. 2.02: Variable names
  14. 2.03: Expressions and statements
  15. 2.04: Script mode
  16. 2.05: Order of operations
  17. 2.06: String operations
  18. 2.07: Comments
  19. 2.08: Debugging
  20. 2.09: Glossary
  21. 2.10: Exercises
  22. 03: Functions
  23. 3.01: Function calls
  24. 3.02: Math functions
  25. 3.03: Composition
  26. 3.04: Adding new functions
  27. 3.05: Definitions and uses
  28. 3.06: Flow of execution
  29. 3.07: Parameters and arguments
  30. 3.08: Variables and parameters are local
  31. 3.09: Stack diagrams
  32. 3.10: Fruitful functions and void functions
  33. 3.11: Why functions
  34. 3.12: Debugging
  35. 3.13: Glossary
  36. 3.14: Exercises
  37. 04: Case study - interface design
  38. 4.01: The turtle module
  39. 4.02: Simple repetition
  40. 4.03: Exercises
  41. 4.04: Encapsulation
  42. 4.05: Generalization
  43. 4.06: Interface design
  44. 4.07: Refactoring
  45. 4.08: A development plan
  46. 4.09: docstring
  47. 4.10: Debugging
  48. 4.11: Glossary
  49. 4.12: Exercises
  50. 05: Conditionals and recursion
  51. 5.01: Floor division and modulus
  52. 5.02: Boolean expressions
  53. 5.03: Logical operators
  54. 5.04: Conditional execution
  55. 5.05: Alternative execution
  56. 5.06: Chained conditionals
  57. 5.07: Nested conditionals
  58. 5.08: Recursion
  59. 5.09: Stack diagrams for recursive functions
  60. 5.10: Infinite recursion
  61. 5.11: Keyboard input
  62. 5.12: Debugging
  63. 5.13: Glossary
  64. 5.14: Exercises
  65. 06: Fruitful functions
  66. 6.01: Return values
  67. 6.02: Incremental development
  68. 6.03: Composition
  69. 6.04: Boolean functions
  70. 6.05: More recursion
  71. 6.06: Leap of faith
  72. 6.07: One more example
  73. 6.08: Checking types
  74. 6.09: Debugging
  75. 6.10: Glossary
  76. 6.11: Exercises
  77. 07: Iteration
  78. 7.01: Reassignment
  79. 7.02: Updating variables
  80. 7.03: The while statement
  81. 7.04: break
  82. 7.05: Square roots
  83. 7.06: Algorithms
  84. 7.07: Debugging
  85. 7.08: Glossary
  86. 7.09: Exercises
  87. 08: Strings
  88. 8.01: A string is a sequence
  89. 8.02: len
  90. 8.03: Traversal with a for loop
  91. 8.04: String slices
  92. 8.05: Strings are immutable
  93. 8.06: Searching
  94. 8.07: Looping and counting
  95. 8.08: String methods
  96. 8.09: The in operator
  97. 8.10: String comparison
  98. 8.11: Debugging
  99. 8.12: Glossary
  100. 8.13: Exercises
  101. 09: Case study - word play
  102. 9.01: Reading word lists
  103. 9.02: Exercises
  104. 9.03: Search
  105. 9.04: Looping with indices
  106. 9.05: Debugging
  107. 9.06: Glossary
  108. 9.07: Exercises
  109. 10: Lists
  110. 10.01: A list is a sequence
  111. 10.02: Lists are mutable
  112. 10.03: Traversing a list
  113. 10.04: List operations
  114. 10.05: List slices
  115. 10.06: List methods
  116. 10.07: Map filter and reduce
  117. 10.08: Deleting elements
  118. 10.09: Lists and strings
  119. 10.10: Objects and values
  120. 10.11: Aliasing
  121. 10.12: List arguments
  122. 10.13: Debugging
  123. 10.14: Glossary
  124. 10.15: Exercises
  125. 11: Dictionaries
  126. 11.01: A dictionary is a mapping
  127. 11.02: Dictionary as a collection of counters
  128. 11.03: Looping and dictionaries
  129. 11.04: Reverse lookup
  130. 11.05: Dictionaries and lists
  131. 11.06: Memos
  132. 11.07: Global variables
  133. 11.08: Debugging
  134. 11.09: Glossary
  135. 11.10: Exercises
  136. 12: Tuples
  137. 12.01: Tuples are immutable
  138. 12.02: Tuple assignment
  139. 12.03: Tuples as return values
  140. 12.04: Variable-length argument tuples
  141. 12.05: Lists and tuples
  142. 12.06: Dictionaries and tuples
  143. 12.07: Sequences of sequences
  144. 12.08: Debugging
  145. 12.09: Glossary
  146. 12.10: Exercises
  147. 13: Case study - data structure selection
  148. 13.01: Word frequency analysis
  149. 13.02: Random numbers
  150. 13.03: Word histogram
  151. 13.04: Most common words
  152. 13.05: Optional parameters
  153. 13.06: Dictionary subtraction
  154. 13.07: Random words
  155. 13.08: Markov analysis
  156. 13.09: Data structures
  157. 13.10: Debugging
  158. 13.11: Glossary
  159. 13.12: Exercises
  160. 14: Files
  161. 14.01: Persistence
  162. 14.02: Reading and writing
  163. 14.03: Format operator
  164. 14.04: Filenames and paths
  165. 14.05: Catching exceptions
  166. 14.06: Databases
  167. 14.07: Pickling
  168. 14.08: Pipes
  169. 14.09: Writing modules
  170. 14.10: Debugging
  171. 14.11: Glossary
  172. 14.12: Exercises
  173. 15: Classes and objects
  174. 15.01: Programmer-defined types
  175. 15.02: Attributes
  176. 15.03: Rectangles
  177. 15.04: Instances as return values
  178. 15.05: Objects are mutable
  179. 15.06: Copying
  180. 15.07: Debugging
  181. 15.08: Glossary
  182. 15.09: Exercises
  183. 16: Classes and functions
  184. 16.01: Time
  185. 16.02: Pure functions
  186. 16.03: Modifiers
  187. 16.04: Prototyping versus planning
  188. 16.05: Debugging
  189. 16.06: Glossary
  190. 16.07: Exercises
  191. 17: Classes and methods
  192. 17.01: Object-oriented features
  193. 17.02: Printing objects
  194. 17.03: Another example
  195. 17.04: A more complicated example
  196. 17.05: The init method
  197. 17.06: The str method
  198. 17.07: Operator overloading
  199. 17.08: Type-based dispatch
  200. 17.09: Polymorphism
  201. 17.10: Debugging
  202. 17.11: Interface and implementation
  203. 17.12: Glossary
  204. 17.13: Exercises
  205. 18: Inheritance
  206. 18.01: Card objects
  207. 18.02: Class attributes
  208. 18.03: Comparing cards
  209. 18.04: Decks
  210. 18.05: Printing the deck
  211. 18.06: Add remove shuffle and sort
  212. 18.07: Inheritance
  213. 18.08: Class diagrams
  214. 18.09: Debugging
  215. 18.10: Data encapsulation
  216. 18.11: Glossary
  217. 18.12: Exercises
  218. 19: The Goodies
  219. 19.01: Conditional expressions
  220. 19.02: List comprehensions
  221. 19.03: Generator expressions
  222. 19.04: any and all
  223. 19.05: Sets
  224. 19.06: Counters
  225. 19.07: defaultdict
  226. 19.08: Named tuples
  227. 19.09: Gathering keyword args
  228. 19.10: Glossary
  229. 19.11: Exercises
  230. 20: Appendix A - Debugging
  231. 20.01: Syntax errors
  232. 20.02: Runtime errors
  233. 20.03: Semantic errors
  234. 21: Appendix B - Analysis of Algorithms
  235. 21.01: Order of growth
  236. 21.02: Analysis of basic Python operations
  237. 21.03: Analysis of search algorithms
  238. 21.04: Hashtables
  239. 21.05: Glossary