Lecture 9
Professor Devin Balkcom
devin@cs.dartmouth.edu
office: Sudikoff 211
Sometimes, we want to write a program that works with pairs of things.
Example: in this part of a times table, there is an entry for each (row, column) pair.
2 | 3 | 4 | |
---|---|---|---|
5 | 10 | 15 | 20 |
6 | 12 | 18 | 24 |
7 | 14 | 21 | 28 |
8 | 16 | 24 | 32 |
for col in range(2, 5):
print 5 * col,
Print an arbitrary row (in PyCharm)
Print all the rows. (in PyCharm)
Step through the times table code with the debugger.
How would you draw the blocks for Arkanoid?
Binary search only works on a sorted list. How can we sort a list? RTFM.
But how do 'sorted()' and 'list.sort()' work?
10 volunteers will show us one way to sort.
1 professor will write the code. selection_sort.py