@@ -330,7 +330,7 @@ \section{Lists, Tuples...}
330330% ---------------------------------------------
331331\begin {frame }[fragile]{Lists}
332332
333- {\Large List Literals}
333+ {\Large Lists Literals}
334334
335335\begin {verbatim }
336336>>> []
@@ -346,7 +346,7 @@ \section{Lists, Tuples...}
346346\end {frame }
347347
348348% ---------------------------------------------
349- \begin {frame }[fragile]{Lists }
349+ \begin {frame }[fragile]{List Indexing }
350350
351351 {\Large Indexing just like all sequences}
352352
@@ -365,9 +365,9 @@ \section{Lists, Tuples...}
365365\end {frame }
366366
367367% ---------------------------------------------
368- \begin {frame }[fragile]{Lists }
368+ \begin {frame }[fragile]{List Mutability }
369369
370- {\Large List are mutable}
370+ {\Large Lists are mutable}
371371
372372\begin {verbatim }
373373>>> food = ['spam', 'eggs', 'ham']
@@ -379,13 +379,13 @@ \section{Lists, Tuples...}
379379\end {frame }
380380
381381% ---------------------------------------------
382- \begin {frame }[fragile]{Lists }
382+ \begin {frame }[fragile]{List Elements }
383383
384384{\Large Each element is a value, and can be in multiple lists and have multiple
385385names (or no name)}
386386
387387\begin {verbatim }
388-  >>> name = 'Brian'
388+ >>> name = 'Brian'
389389 >>> a = [1, 2, name]
390390 >>> b = [3, 4, name]
391391 >>> name
@@ -403,9 +403,9 @@ \section{Lists, Tuples...}
403403\end {frame }
404404
405405% ---------------------------------------------
406- \begin {frame }[fragile]{Lists }
406+ \begin {frame }[fragile]{List Methods }
407407
408- {\Large  \verb | .append(), .insert() |}
408+ {\Large \verb | .append(), .insert() |}
409409
410410\begin {verbatim }
411411>>> food = ['spam', 'eggs', 'ham']
@@ -420,9 +420,9 @@ \section{Lists, Tuples...}
420420\end {frame }
421421
422422% ---------------------------------------------
423- \begin {frame }[fragile]{Lists }
423+ \begin {frame }[fragile]{List Methods }
424424
425- {\large  \verb | .extend() |}
425+ {\large \verb | .extend() |}
426426
427427\begin {verbatim }
428428>>> food = ['spam', 'eggs', 'ham']
@@ -445,9 +445,9 @@ \section{Lists, Tuples...}
445445\end {frame }
446446
447447% ---------------------------------------------
448- \begin {frame }[fragile]{Lists }
448+ \begin {frame }[fragile]{List Methods }
449449
450- {\large  \verb | pop(), remove() |}
450+ {\large \verb |pop(), remove() |}
451451
452452\begin {verbatim }
453453In [203]: food = ['spam', 'eggs', 'ham', 'toast']
@@ -461,14 +461,12 @@ \section{Lists, Tuples...}
461461In [208]: food
462462Out[208]: ['eggs']
463463\end {verbatim }
464-
465464\end {frame }
466- 
467465
468466% ---------------------------------------------
469- \begin {frame }[fragile]{Lists }
467+ \begin {frame }[fragile]{List Constructor }
470468
471- {\large  \verb |list() | accepts any sequence and returns a list of that sequence}
469+ {\large \verb |list() | accepts any sequence and returns a list of that sequence}
472470\begin {verbatim }
473471>>> word = 'Python '
474472>>> chars = []
@@ -479,11 +477,11 @@ \section{Lists, Tuples...}
479477>>> list(word)
480478['P', 'y', 't', 'h', 'o', 'n', ' ']
481479\end {verbatim }
482-
483480\end {frame }
484- 
481+
482+
485483% ---------------------------------------------
486- \begin {frame }[fragile]{Lists }
484+ \begin {frame }[fragile]{String to List to String }
487485
488486{\large If you need to change individual letters... you can do this,
489487but usually \verb |somestring.replace() | will be enough }
@@ -498,11 +496,10 @@ \section{Lists, Tuples...}
498496\end {verbatim }
499497
500498\end {frame }
501- 
502- % ---------------------------------------------
503- \begin {frame }[fragile]{Lists}
504499
505- {\large Building up strings:}
500+
501+ % ---------------------------------------------
502+ \begin {frame }[fragile]{Building up strings in a list}
506503
507504\begin {verbatim }
508505In [221]: msg = []
@@ -522,7 +519,7 @@ \section{Lists, Tuples...}
522519\end {frame }
523520
524521% ---------------------------------------------
525- \begin {frame }[fragile]{Slicing}
522+ \begin {frame }[fragile]{List Slicing}
526523
527524{\large Slicing makes a copy}
528525
@@ -544,7 +541,7 @@ \section{Lists, Tuples...}
544541
545542
546543% ---------------------------------------------
547- \begin {frame }[fragile]{Slicing}
544+ \begin {frame }[fragile]{List Slicing}
548545
549546{\large Easy way to copy a whole list}
550547
@@ -559,12 +556,13 @@ \section{Lists, Tuples...}
559556
560557\end {verbatim }
561558
562- {\Large but the copy is `` shallow'' }
559+ {\Large but the copy is `` shallow'' }: \
560+ \url {http://docs.python.org/library/copy.html}
563561
564562\end {frame }
565563
566564% ---------------------------------------------
567- \begin {frame }[fragile]{Slicing}
565+ \begin {frame }[fragile]{List Slicing}
568566
569567{\Large `` Shallow'' copy}
570568
@@ -606,7 +604,7 @@ \section{Lists, Tuples...}
606604\end {frame }
607605
608606% ---------------------------------------------
609- \begin {frame }[fragile]{Iterating}
607+ \begin {frame }[fragile]{List Iterating}
610608
611609{\Large Iterating over a list}
612610
@@ -624,7 +622,7 @@ \section{Lists, Tuples...}
624622\end {frame }
625623
626624% ---------------------------------------------
627- \begin {frame }[fragile]{Processing lists }
625+ \begin {frame }[fragile]{Processing Lists }
628626
629627{\Large A common pattern}
630628
@@ -643,7 +641,7 @@ \section{Lists, Tuples...}
643641% ---------------------------------------------
644642\begin {frame }[fragile]{Mutating Lists}
645643
646- {\Large if you’ re going to change the list, iterate over a copy for safety }
644+ {\Large if you' re going to change the list, iterate over a copy for safety }
647645
648646\begin {verbatim }
649647>>> food = ['spam', 'eggs', 'ham', 'sushi']
@@ -674,14 +672,15 @@ \section{Lists, Tuples...}
674672 >>> food
675673 ['spam', 'eggs', 'ham', 'fish', 'chips']
676674\end {verbatim }
675+ (the operator makes a new list...)
677676
678677\end {frame }
679678
680679% ---------------------------------------------
681680\begin {frame }[fragile]{in}
682681
683682\begin {verbatim }
684-  >>> food = ['spam', 'eggs', 'ham']
683+ >>> food = ['spam', 'eggs', 'ham']
685684>>> 'eggs' in food
686685True
687686>>> 'chicken feet' in food
@@ -693,10 +692,9 @@ \section{Lists, Tuples...}
693692% ---------------------------------------------
694693\begin {frame }[fragile]{reverse()}
695694
696- {\large Iterating over a list}
697695
698696\begin {verbatim }
699-  >>> food = ['spam', 'eggs', 'ham']
697+ >>> food = ['spam', 'eggs', 'ham']
700698>>> food.reverse()
701699>>> food
702700['ham', 'eggs', 'spam']
@@ -809,7 +807,7 @@ \section{Lists, Tuples...}
809807\begin {frame }[fragile]{List Performance }
810808
811809\begin {itemize }
812- \item  indexing is fast and constant time: O(1)
810+ \item indexing is fast and constant time: O(1)
813811 \item x in s proportional to n: O(n)
814812 \item visiting all is proportional to n: O(n)
815813 \item operating on the end of list is fast and constant time: O(1) \\
@@ -978,7 +976,7 @@ \section{Lists, Tuples...}
978976 'AttributeError',
979977 'BufferError',
980978 'EOFError',
981- 'EnvironmentError',
979+ ....
982980\end {verbatim }
983981
984982\end {frame }
@@ -1026,6 +1024,10 @@ \section{Lists, Tuples...}
10261024
10271025\vfill
10281026{\LARGE Dan's list Lab}
1027+
1028+ \vfill
1029+ \url {https://github.com/PythonCHB/PythonIntroClass/wiki/Week-4-Exercises}
1030+
10291031\vfill
10301032
10311033\end {frame }
@@ -1055,7 +1057,7 @@ \section{Dictionaries and Sets}
10551057{\Large Python calls it a \verb |dict | }
10561058
10571059\vfill
1058- {\Large Other terms :}
1060+ {\Large Other languages call it :}
10591061\begin {itemize }
10601062 \item dictionary
10611063 \item associative array
@@ -1102,10 +1104,10 @@ \section{Dictionaries and Sets}
11021104>>> d = {1: 'one', 0: 'zero'}
11031105>>> d[0]
11041106'zero'
1105- >>> d['non-‐ existing key']
1107+ >>> d['non-existing key']
11061108Traceback (most recent call last):
11071109 File "<stdin>", line 1, in <module>
1108- KeyError: 'fish '
1110+ KeyError: 'non-existing key '
11091111\end {verbatim }
11101112
11111113\end {frame }
@@ -1190,7 +1192,7 @@ \section{Dictionaries and Sets}
11901192\vfill
11911193also... Python name look-ups are implemented with dict:
11921194
1193- --- it’s highly optimized
1195+ --- its highly optimized
11941196\end {frame }
11951197
11961198
@@ -1225,7 +1227,7 @@ \section{Dictionaries and Sets}
12251227\end {frame }
12261228
12271229% ---------------------------------------------
1228- \begin {frame }[fragile]{Dictionary Indexing }
1230+ \begin {frame }[fragile]{Dictionary Ordering (not) }
12291231
12301232\vfill
12311233{\Large
@@ -1245,7 +1247,7 @@ \section{Dictionaries and Sets}
12451247\end {frame }
12461248
12471249% -------------------------------
1248- \begin {frame }[fragile]{dict iterating }
1250+ \begin {frame }[fragile]{Dictionary Iterating }
12491251
12501252{\Large \verb |for | iterates the keys}
12511253\vfill
@@ -1283,7 +1285,7 @@ \section{Dictionaries and Sets}
12831285{\Large iterating on everything}
12841286\vfill
12851287\begin {verbatim }
1286-  >>> d = {'name': 'Brian', 'score': 42}
1288+ >>> d = {'name': 'Brian', 'score': 42}
12871289>>> for k, v in d.items():
12881290... print "%s: %s" % (k, v)
12891291...
@@ -1297,7 +1299,7 @@ \section{Dictionaries and Sets}
12971299\begin {frame }[fragile]{Dictionary Performance }
12981300
12991301\begin {itemize }
1300- \item  indexing is fast and constant time: O(1)
1302+ \item indexing is fast and constant time: O(1)
13011303 \item x in s cpnstant time: O(1)
13021304 \item visiting all is proportional to n: O(n)
13031305 \item inserting is constant time: O(1)
@@ -1521,19 +1523,21 @@ \section{Dictionaries and Sets}
15211523% -------------------------------
15221524\begin {frame }{LAB}
15231525
1524- {\LARGE Dan's dict LAB
1526+ {\Large Dan's dict LAB:}\\
1527+ \url {https://github.com/PythonCHB/PythonIntroClass/wiki/Week-4-Exercises}
15251528
15261529\vfill
1530+
15271531or
15281532
15291533\vfill
1530- Optional LAB
1531- }
1534+ { \Large Optional LAB}
1535+
15321536
15331537\begin {itemize }
15341538 \item Coding Kata 14 - Dave Thomas \\
15351539 \url {http://codekata.pragprog.com/2007/01/ kata_fourteen_t.html}
1536- \item See how far you can get on this task using “ The Adventures of Sherlock Holmes” as input: sherlock.txt in the week04 directory (ascii)
1540+ \item See how far you can get on this task using The Adventures of Sherlock Holmes as input: sherlock.txt in the week04 directory (ascii)
15371541 \item This is intentionally open-ended and underspecified. There are many interesting decisions to make.
15381542\end {itemize }
15391543
0 commit comments