Skip to content

Commit ddbcc1d

Browse files
committed
fixed a couple more typos in the dict comps lab
1 parent 684aec0 commit ddbcc1d

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

slides_sources/source/exercises/comprehensions_lab.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ https://github.com/gregmalcolm/python_koans/blob/master/python3/koans/about_comp
164164
Count Even Numbers
165165
------------------
166166

167-
Use test-driven development!
168-
169167
This is from CodingBat "count_evens" (http://codingbat.com/prob/p189616)
170168

171169
*Using a list comprehension*, return the number of even integers in the given array.
@@ -190,7 +188,7 @@ Note: the % "mod" operator computes the remainder, e.g. ``5 % 2`` is 1.
190188
``dict`` and ``set`` comprehensions
191189
------------------------------------
192190

193-
Let's revisiting the dict/set lab -- see how much you can do with
191+
Revisiting the dict/set lab -- see how much you can do with
194192
comprehensions instead.
195193

196194
(:ref:`exercise_dict_lab`)

slides_sources/source/session05.rst

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,30 @@ What if you want a case-insensitive count?
8787
In [3]: s.lower().count('t')
8888
Out[3]: 3
8989
90+
set.update()
91+
------------
92+
93+
If you want to add a bunch of stuff to a set, you can use update:
94+
95+
.. code-block:: ipython
96+
97+
In [1]: s = set()
98+
99+
In [2]: s.update
100+
Out[2]: <function set.update>
101+
102+
In [3]: s.update(['this', 'that'])
103+
104+
In [4]: s
105+
Out[4]: {'that', 'this'}
106+
107+
In [5]: s.update(['this', 'thatthing'])
108+
109+
In [6]: s
110+
Out[6]: {'that', 'thatthing', 'this'}
111+
112+
**NOTE:** It's VERY often the case that when you find yourself writing a trivial loop -- there is a way to do it with a built in method!
113+
90114

91115

92116
Sorting stuff in dictionaries:
@@ -280,6 +304,8 @@ But some of you are not sure how to start.
280304

281305
So let's start from the beginning...
282306

307+
NOTE: think about set vs list.
308+
283309
(demo)
284310

285311
Lightning Talks
@@ -727,7 +753,6 @@ Catch up!
727753
Material to review before next week:
728754
====================================
729755
730-
<<<<<<< HEAD
731756
**Unit Testing:**
732757
733758
* Dive into Python: chapter 9:
@@ -736,19 +761,14 @@ Material to review before next week:
736761
NOTE: you will find that most introductions to unit testing with Python use the builtin ``unitest`` module. However, it is a bit heavyweight, and requires some knowledge of OOP -- classes, etc. So we'll be using pytest in this class: http://doc.pytest.org/en/latest/. But the principles of testing are the same.
737762
738763
* Ned Batchelder's into to testing presentation:
739-
http://nedbatchelder.com/text/test0.html
764+
765+
- http://nedbatchelder.com/text/test0.html
740766
741767
** Advanced Argument Passing
742768
743769
* arguments and parameters:
744-
http://stupidpythonideas.blogspot.com/2013/08/arguments-and-parameters.html
745-
=======
746-
Advanced Argument Passing:
747770
748-
https://pythontips.com/2013/08/04/args-and-kwargs-in-python-explained/
771+
- http://stupidpythonideas.blogspot.com/2013/08/arguments-and-parameters.html
749772
750-
Lambda:
773+
- https://pythontips.com/2013/08/04/args-and-kwargs-in-python-explained/
751774
752-
http://www.blog.pythonlibrary.org/2015/10/28/python-101-lambda-basics/
753-
https://pythonconquerstheuniverse.wordpress.com/2011/08/29/lambda_tutorial/
754-
>>>>>>> 6c9ee7938fd092bce1f3fe304ebb95b7214bcfcc

0 commit comments

Comments
 (0)