Note that the schedule of lectures is tentative and may change, particularly after the mid-semester break.
Week 1 (25th of Jul - 31st of Jul)#
Lectures:
- Lecture 1 (Monday): Introduction to the course and administrative matters (slides).
- Lecture 2 (Tuesday): Functional abstraction (slides).
Code:
Week 2 (1st of Aug - 7th of Aug)#
Lectures:
Code:
- Data analysis with function (Lecture 4).
- Triangulation example, with functions.
The
sin_of_deg
anddeg_to_rad
functions are the ones used in the call stack example. - Approximate derivative (Lecture 4).
- Function calling and variable interactions (Lecture 4).
Reading guide:
- In Downey: Chapters 1, 2 and 3.
- In Punch & Enbody: Chapter 1 (excluding 1.10) and the beginning of Chapter 6, up to (not including) 6.3.3.
Week 3 (8th of Aug - 14th of Aug)#
Lectures:
- Lecture 5 (Monday): Program control flow, part 1: Branching (slides).
-
Lecture 6 (Tuesday): Program control flow, part 2: Iteration (slides)
- Stack Red Boxes
- Print Grade
- Count Boxes
- Count Boxes using iterations
- Interval Halving using iterations
- Greatest common divisor
- for loop examples
Reading guide:
- In Downey: Chapter 5, Chapter 6 up to (not including) section “More Recursion”, and Chapter 7.
- In Punch & Enbody: Chapter 2, except the parts about
for
loops (for example, section 2.2.13).
Week 4 (15th of Aug - 21st of Aug)#
- Lecture 7 (Monday): Iteration continued (no new slides, still lecture 6 slides).
- Lecture 8 (Tuesday): Sequence data types, part 1 (slides).
Reading guide:
Both books begin with strings as the first sequence type. We will get to strings in Week 5. However, parts of the relevant chapters describe properties of strings that are in fact common to all sequence types, and can be read without worrying about character representation.
- In Downey: Chapter 8, up to (not including) section “String Methods”.
- In Punch & Enbody: Section 4.1 (sections 4.1.1 and 4.1.2 are specific to strings, and will become relevant in Week 5).
Week 5 (22nd of Aug - 28th of Aug)#
- Lecture 9 (Monday): Code quality, testing and debugging (slides).
- Python debugger commands (slides).
- Lecture 10 (Tuesday): Strings and more sequences (slides).
Code:
- Longest Repeated Substring
- Example code used for debugger tutorial:use module
- Example code used for debugger tutorial:implement module
Reading guide:
- In Downey: Chapter 8.
- In Punch & Enbody: Chapter 4. Section 4.4 and 4.7 on string formatting can be skipped.
- Downey’s book has a section on debugging in every chapter. The advice in the debugging sections of chapters 1 through 8 is all relevant and useful to debugging the kinds of programs we have written so far.
Week 6 (29th of Aug - 4th of Sep)#
- Lecture 11 (Monday): Data Science (slides).
- Lecture 12 (Tuesday): Mutable sequence data types, part 2 (slides)
Code:
Break#
Week 7 (19th of Sep - 25th of Sep)#
Code:
Reading guide:
- In Downey: Chapter 10 (lists), Chapters 3, 5 and 6, and section “Global variables” in Chapter 11 (functions and scope).
- In Punch & Enbody: Chapter 7, except 7.7 (lists). Note: Sections 7.5.2 and 7.9 contain examples that use file reading, which we have not covered yet. You can skip these sections, or just just copy-paste the file-reading code and not worry too much about it.
- Chapter 6, up to (not including) section 6.3.4; Section 8.1; Section 9.6 (functions and scope).
Week 8 (26th of Sep - 2nd of Oct)#
Code:
Reading guide:
- In Downey: Chapter 14, up to section 14.4 “Catching Exceptions” (files), though the remainder of the chapter is useful reading if you want to do more complex file operations.
- In Punch & Enbody: Chapter 5, up to (not including) section 5.6 (files).
- In Downey: Chapter 11 up to section “Memos” and section “Sets” in Chapter 19 (Chapter 19 is covers a variety of topics, some of which we have already touched on, and some which we will not cover in this course.)
- In Punch & Enbody: Chapter 9 up to (not including) section 9.6 (dictionaries and sets).
Week 9 (3rd of Oct - 9th of Oct)#
- No Monday lecture (Labour Day).
-
Lecture 17 (Tuesday): Computational Complexity (slides)
- Examples from the lecture on complexity
Reading guide:
- In Downey: Chapter 21 (“Analysis of Algorithms”, called Appendix B in the on-line editition) introduces complexity analysis of algorithms.
Week 10 (10th of Oct - 16th of Oct)#
- Lecture 18 (Monday): Errors and Exceptions (slides)
- Lecture 19 (Tuesday): Data science 2: Numpy and pandas (slides).
Code:
Reading guide:
- In Downey: Chapter 20 (called “Appendix A” in the on-line edition), and section “Catching Exceptions” in Chapter 14.
- In Punch & Enbody: Section 5.6 and Sections 14.4 to 14.6 cover exceptions (with a focus on handling, unfortunately).
Week 11 (17th of Oct - 23rd of Oct)#
- Lecture 20 (Monday): Data science 2 cont’: Pandas (see slides from last lecture).
- Lecture 21 (Tuesday): Program control flow, part 3: Dynamic programming (slides).
Code:
- Numpy versus list performance
- dynamic programming implementation of “n choose k”
- sequence alignment, recursive and dynamic programming
Reading guide:
- Section “Memos” in Chapter 11 of Downey’s book briefly covers the idea behind dynamic programming (but considers only using a dictionary to store the intermediate results).
Week 12 (24th of Oct - 30th of Oct)#
- Lecture 22 (Monday): Design and review
- Lecture 23 (Tuesday): Exam revision (slides).
Code: