How to Think Like a Computer Scientist: Interactive Edition
Table of Contents¶
- 1. General Introduction
- 1.1. The Way of the Program
- 1.2. Algorithms
- 1.3. The Python Programming Language
- 1.4. Executing Python in this Book
- 1.5. More About Programs
- 1.6. What is Debugging?
- 1.7. Syntax errors
- 1.8. Runtime Errors
- 1.9. Semantic Errors
- 1.10. Experimental Debugging
- 1.11. Formal and Natural Languages
- 1.12. A Typical First Program
- 1.13. Comments
- 1.14. Glossary
- 1.15. Exercises
- 2. Simple Python Data 1
- 3. Simple Python Data 2
- 4. Booleans and Conditionals
- 5. For Loops and Turtle Graphics
- 5.1. Hello Little Turtles!
- 5.2. Our First Turtle Program
- 5.3. Instances — A Herd of Turtles
- 5.4. The
for
Loop - 5.5. Flow of Execution of the for Loop
- 5.6. Iteration Simplifies our Turtle Program
- 5.7. The range Function
- 5.8. A Few More turtle Methods and Observations
- 5.9. Summary of Turtle Methods
- 5.10. Glossary
- 5.11. Exercises
- 6. Strings
- 6.1. Strings Revisited
- 6.2. A Collection Data Type
- 6.3. Operations on Strings
- 6.4. Index Operator: Working with the Characters of a String
- 6.5. String Methods
- 6.6. Length
- 6.7. The Slice Operator
- 6.8. String Comparison
- 6.9. Strings are Immutable
- 6.10. Traversal and the
for
Loop: By Item - 6.11. Traversal and the
for
Loop: By Index - 6.12. Traversal and the
while
Loop - 6.13. The
in
andnot in
operators - 6.14. The Accumulator Pattern with Strings
- 6.15. Turtles and Strings and L-Systems
- 6.16. Looping and Counting
- 6.17. A
find
function - 6.18. Optional parameters
- 6.19. Character classification
- 6.20. Summary
- 6.21. Glossary
- 6.22. Exercises
- 7. Lists
- 7.1. Lists
- 7.2. List Values
- 7.3. List Length
- 7.4. Accessing Elements
- 7.5. List Membership
- 7.6. Concatenation and Repetition
- 7.7. List Slices
- 7.8. Lists and
for
loops - 7.9. Lists are Mutable
- 7.10. List Deletion
- 7.11. Objects and References
- 7.12. Aliasing
- 7.13. Cloning Lists
- 7.14. Repetition and References
- 7.15. List Methods
- 7.16. Append versus Concatenate
- 7.17. List Comprehensions
- 7.18. Nested Lists
- 7.19. Strings and Lists
- 7.20.
list
Type Conversion Function
- 8. More About Iteration
- 9. Debugging Interlude
- 10. Python Modules
- 11. Functions
- 12. Functions, Side Effects and Tuples
- 13. Recursion
- 14. Dictionaries
- 15. Classes and Objects
- 15.1. Object-oriented programming
- 15.2. A change of perspective
- 15.3. Objects Revisited
- 15.4. User Defined Classes
- 15.5. Improving our Constructor
- 15.6. Adding Other Methods to our Class
- 15.7. Objects as Arguments and Parameters
- 15.8. Converting an Object to a String
- 15.9. Instances as Return Values
- 15.10. Glossary
- 15.11. Exercises
- 16. Image Processing with Nested Loops and GUI Programming
- 16.1. 2-Dimensional Iteration: Image Processing
- 16.2. Graphical User Interfaces
- 16.3. GUI Programming
- 16.4. GUI Programming Options
- 16.5. TKinter
- 16.6. Tkinter Pre-programmed Interfaces
- 16.7. Tkinter Custom Interfaces
- 16.8. Hello World
- 16.9. Tkinter Standard Dialog Boxes
- 16.10. GUI Widgets
- 16.11. Creating Widgets
- 16.12. Layout Mangers
- 16.13. Specifying Dimensions
- 16.14. Place Layout Manager
- 16.15. Grid Layout Manager
- 16.16. Pack Layout Manager
- 16.17. Widget Groupings
- 16.18. Command Events
- 16.19. Hello World Again
- 16.20. Other Events
- 16.21. Low-Level Event Processing
- 16.22. Focus
- 16.23. Event Binding
- 16.24. Event Descriptors
- 16.25. Event Objects
- 16.26. Event Processing
- 17. Files
Optional Labs¶
Appendices¶
Acknowledgements¶
- Copyright Notice
- Preface to the Interactive Edition
- Whats the deal with Logging in?
- How to Contribute
- Acknowledgements
- Foreword
- Preface to the Third Edition
- The Rhodes Local Edition (RLE)
- Preface to the First and Second Editions
- Contributor List
- GNU Free Documentation License
- ADDENDUM: How to use this License for your documents
Index and Search¶
About this Project¶
This interactive book is a product of the Runestone Interactive Project at Luther College, led by Brad Miller and David Ranum. There have been many contributors to the project. Our thanks especially to the following:
- This book is based on the Original work by: Jeffrey Elkner, Allen B. Downey, and Chris Meyers
- Activecode based on Skulpt
- Codelens based on Online Python Tutor
- Many contributions from the CSLearning4U research group at Georgia Tech.
- ACM-SIGCSE for the special projects grant that funded our student Isaac Dontje Lindell for the summer of 2013.
- NSF
The Runestone Interactive tools are open source and we encourage you to contact us, or grab a copy from GitHub if you would like to use them to write your own resources.
The sections of this particular version of the book were arranged by Christopher Schuster for the CMPS5P Introduction to Programming with Python course at University of California, Santa Cruz.