# CompSci 101, Spring 2018 Readings

### Textbook (Required)

Clicking on the link below will take you to the Runestone Interactive E-book. This is a free book required for Compsci 101 at Duke. You'll need to register for the book by specifying a username. For the course name choose DukeCompsci101 -- this will allow you to track your progress and for us to track the class' progress.
 How To Think Like a Computer Scientist - Learning with Python: Interactive Edition by Jeffrey Elkner, Allen B. Downey, and Chris Meyer

How to get the book:

• This book is an electronic book and is free. However, it costs money to run the server for this electronic book. This book will allow you to experiment with python examples right in the book.

We Strongly encourage giving a donation to help support the book, we suggest \$15 .

#### Week 1: 1/15 - 1/19, Reading Quiz 1

• 1. General Introduction (all)
• 2. Simple Python Data (all)

#### Week 2: 1/22 - 1/26, Reading Quiz 2

• 3. Debugging Interlude 1 (all)
• 4.1-4.3
• 4.1. Hello Little Turtles!
• 4.2. Our First Turtle Program
• 4.3. Instances - A Herd of Turtles
• 5. Python Modules (all)
• 6.1-6.4
• 6.1. Functions
• 6.2. Functions that Return Values
• 6.3. Unit Testing
• 6.4. Variables and Parameters are Local

#### Week 3: 1/29 - 2/2, Reading Quiz 3

• 4.4-4.6
• 4.4. The for Loop
• 4.5. Flow of Execution of the for Loop
• 4.6. Iteration Simplifies our Turtle Program
• 7.1-7.5
• 7.1. Boolean Values and Boolean Expressions
• 7.2. Logical operators
• 7.3. Precedence of Operators
• 7.4. Conditional Execution: Binary Selection
• 7.5. Omitting the else Clause: Unary Selection
• 9.1-9.7
• 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

#### Week 4: 2/5 - 2/9, Reading Quiz 4

• 4.7-4.11
• 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
• 6.5. The Accumulator Pattern
• 9.8-9.11, 9.14, 9.16
• 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.14. The Accumulator Pattern with Strings
• 9.16. Looping and Counting
• 10.1-10.8, 10.14
• 10.1. Lists
• 10.2. List Values
• 10.3. List Length
• 10.4. Accessing Elements
• 10.6. Concatenation and Repetition
• 10.7. List Slices
• 10.8. Lists are Mutable
• 10.14. List Methods

#### Week 6: 2/19 - 2/23, Reading Quiz 5

• 8.1-8.3, 8.8
• 8.1. Iteration Revisited
• 8.2. The for loop revisited
• 8.3. The while Statement
• 8.8. Other uses of while
• 11.1-11.6, 11.8, 11.9
• 11.1. Working with Data Files
• 11.2. Finding a File on your Disk
• 11.4. Iterating over lines in a file
• 11.5. Alternative File Reading Methods
• 11.6. Writing Text Files
• 11.8. Glossary
• 11.9. Exercises
• All the sections in Sets at wikibooks, except "frozenset"

#### Week 7: 2/26 - 3/2, Reading Quiz 6

• 8.11 2-Dimensional Iteration: Image Processing
• 10.9-10.13, 10.15-10.25
• 10.9. List Deletion
• 10.10. Objects and References
• 10.11. Aliasing
• 10.12. Cloning Lists
• 10.13. Repetition and References
• 10.15. The Return of L-Systems
• 10.16. Append versus Concatenate
• 10.17. Lists and for loops
• 10.18. Using Lists as Parameters
• 10.19. Pure Functions
• 10.20. Which is Better?
• 10.21. Functions that Produce Lists
• 10.22. List Comprehensions
• 10.23. Nested Lists
• 10.24. Strings and Lists
• 10.25. list Type Conversion Function

#### Week 8: 3/5 - 3/9, Reading Quiz 7

• 10.26-10.28
• 10.26. Tuples and Mutability
• 10.27. Tuple Assignment
• 10.28. Tuples as Return Values

#### Week 9: 3/19 - 3/23, Reading Quiz 8

• 12.1-12.4, 12.6, 12.7
• 12.1. Dictionaries
• 12.2. Dictionary Operations
• 12.3. Dictionary Methods
• 12.4. Aliasing and Copying
• 12.6. Glossary
• 12.7. Exercises

#### Week 10: 3/26 - 3/30, Reading Quiz 9

• The introduction and definition sections of wikipedia's page on prime numbers
• Reading the introduction of the CSV module documentation and about the following functions:
• csv.writer
• csvwriter.writerow
• csvwriter.writerows

#### Week 11: 4/2 - 4/6, Reading Quiz 10

• Read Python.org's how to on sorting, focusing on the following parts:
• Introduction
• Sorting Basics
• First example in Key Functions (You do not need to understand the other examples)
• itemgetter in Operator Module Functions (You do not need to understand attrgetter and methodcaller)
• Ascending and Descending
• Sort Stability and Complex Sorts