How to Think Like a Computer Scientist: Interactive Edition
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.
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
- 2.1. Variables, Expressions and Statements
- 2.2. Values and Data Types
- 2.3. Type conversion functions
- 2.4. Variables
- 2.5. Variable Names and Keywords
- 2.6. Statements and Expressions
- 2.7. Operators and Operands
- 2.8. Input
- 2.9. Order of Operations
- 2.10. Reassignment
- 2.11. Updating Variables
- 2.12. Glossary
- 2.13. Exercises
- 3. Debugging Interlude 1
- 4. Python Turtle Graphics
- 4.1. Hello Little Turtles!
- 4.2. Our First Turtle Program
- 4.3. Instances — A Herd of Turtles
- 4.4. The
for
Loop - 4.5. Flow of Execution of the for Loop
- 4.6. Iteration Simplifies our Turtle Program
- 4.7. The range Function
- 4.8. A Few More turtle Methods and Observations
- 4.9. Summary of Turtle Methods
- 4.10. Glossary
- 4.11. Exercises
- 5. Python Modules
- 6. Functions
- 6.1. Functions
- 6.2. Functions that Return Values
- 6.3. Unit Testing
- 6.4. Variables and Parameters are Local
- 6.5. The Accumulator Pattern
- 6.6. Functions can Call Other Functions
- 6.7. Flow of Execution Summary
- 6.8. Using a Main Function
- 6.9. Program Development
- 6.10. Composition
- 6.11. A Turtle Bar Chart
- 6.12. Glossary
- 6.13. Exercises
- 7. Selection
- 8. More About Iteration
- 8.1. Iteration Revisited
- 8.2. The
for
loop revisited - 8.3. The
while
Statement - 8.4. Randomly Walking Turtles
- 8.5. The 3n + 1 Sequence
- 8.6. Newton’s Method
- 8.7. The Accumulator Pattern Revisited
- 8.8. Other uses of
while
- 8.9. Algorithms Revisited
- 8.10. Simple Tables
- 8.11. 2-Dimensional Iteration: Image Processing
- 8.12. Image Processing on Your Own
- 8.13. Glossary
- 8.14. Exercises
- 9. Strings
- 9.1. Strings Revisited
- 9.2. A Collection Data Type
- 9.3. Operations on Strings
- 9.4. Index Operator: Working with the Characters of a String
- 9.5. String Methods
- 9.6. Length
- 9.7. The Slice Operator
- 9.8. String Comparison
- 9.9. Strings are Immutable
- 9.10. Traversal and the
for
Loop: By Item - 9.11. Traversal and the
for
Loop: By Index - 9.12. Traversal and the
while
Loop - 9.13. The
in
andnot in
operators - 9.14. The Accumulator Pattern with Strings
- 9.15. Turtles and Strings and L-Systems
- 9.16. Looping and Counting
- 9.17. A
find
function - 9.18. Optional parameters
- 9.19. Character classification
- 9.20. Summary
- 9.21. Glossary
- 9.22. Exercises
- 10. Lists
- 10.1. Lists
- 10.2. List Values
- 10.3. List Length
- 10.4. Accessing Elements
- 10.5. List Membership
- 10.6. Concatenation and Repetition
- 10.7. List Slices
- 10.8. Lists are Mutable
- 10.9. List Deletion
- 10.10. Objects and References
- 10.11. Aliasing
- 10.12. Cloning Lists
- 10.13. Repetition and References
- 10.14. List Methods
- 10.15. The Return of L-Systems
- 10.16. Append versus Concatenate
- 10.17. Lists and
for
loops - 10.18. The Accumulator Pattern with Lists
- 10.19. Using Lists as Parameters
- 10.20. Pure Functions
- 10.21. Which is Better?
- 10.22. Functions that Produce Lists
- 10.23. List Comprehensions
- 10.24. Nested Lists
- 10.25. Strings and Lists
- 10.26.
list
Type Conversion Function - 10.27. Tuples and Mutability
- 10.28. Tuple Assignment
- 10.29. Tuples as Return Values
- 10.30. Glossary
- 10.31. Exercises
- 11. Files
- 12. Dictionaries
- 13. Exceptions
- 14. Web Applications
- 15. GUI and Event Driven Programming
- 15.1. Graphical User Interfaces
- 15.2. GUI Programming
- 15.3. GUI Programming Options
- 15.4. TKinter
- 15.5. Tkinter Pre-programmed Interfaces
- 15.6. Tkinter Custom Interfaces
- 15.7. Hello World
- 15.8. Tkinter Standard Dialog Boxes
- 15.9. GUI Widgets
- 15.10. Creating Widgets
- 15.11. Layout Mangers
- 15.12. Specifying Dimensions
- 15.13. Place Layout Manager
- 15.14. Grid Layout Manager
- 15.15. Pack Layout Manager
- 15.16. Widget Groupings
- 15.17. Command Events
- 15.18. Hello World Again
- 15.19. Other Events
- 15.20. Low-Level Event Processing
- 15.21. Focus
- 15.22. Event Binding
- 15.23. Event Descriptors
- 15.24. Event Objects
- 15.25. Event Processing
- 15.26. The Design of GUI Programs
- 15.27. Common Widget Properties
- 15.28. Specific Widget Properties
- 15.29. Widget Attributes
- 15.30. Timer Events
- 15.31. A Programming Example
- 15.32. Managing GUI Program Complexity
- 15.33. Exercises
- 15.34. Glossary
- 16. Recursion
- 17. Classes and Objects - the Basics
- 17.1. Object-oriented programming
- 17.2. A change of perspective
- 17.3. Objects Revisited
- 17.4. User Defined Classes
- 17.5. Improving our Constructor
- 17.6. Adding Other Methods to our Class
- 17.7. Objects as Arguments and Parameters
- 17.8. Converting an Object to a String
- 17.9. Instances as Return Values
- 17.10. Glossary
- 17.11. Exercises
- 18. Classes and Objects - Digging a Little Deeper
- 19. Inheritance
- 20. Unit Testing
- 21. Hidden Items
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¶
You have attempted of activities on this page