@extends('template') @section('title') Lab 10 Dictionaries @stop @section('content') # Lab 10 Dictionaries {{-- ## [Python Solutions](/content/labs/lab10/solutions) --}} {{-- ## [Worksheet Solutions](https://docs.google.com/document/d/1FuBlXDxisbOsv3pRsJ-S3CfYPeP-QF06XUAr3g5g61g/edit?usp=sharing) --}} ## Summary Practice with Python dictionaries {{-- ## Today's paper worksheet * Google doc worksheet: [click here for worksheet](https://docs.google.com/document/d/1cKwb2ZASxvafWvrA4KOduqDRwBJQUi4FPar61GlEUvA/edit?usp=sharing) --}} {{-- update with relevant lecture notes --}} {{-- ## Videos Here is the [youtube playlist with all the videos for this lab](https://www.youtube.com/playlist?list=PLX93PuaDL2dJuCzfspNey5BtJgbYM6Xyx). Below is a list of each separate video. * (0/6) Worksheet Review [YouTube](https://youtu.be/lR08eZXiqGQ) | [Download](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab100outta6DictionariesWarmupWorksheet.mp4) | [Captions](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab100outta6DictionariesWarmupWorksheet.sbv) * (1/6) Part 1 Overview [YouTube](https://youtu.be/X9UDfAOauww) | [Download](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab101outta6CS111dictOverview.mp4) | [Captions](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab101outta6CS111dictOverview.sbv) * (2/6) Part 1 Code Implementation [YouTube](https://youtu.be/cG6xGbnm6_U) | [Download](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab102outta6CS111dictpythoncodeimplementation.mp4) | [Captions](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab102outta6CS111dictpythoncodeimplementation.sbv) * (3/6) Part 2 Intro [YouTube](https://youtu.be/GI6E02AaY30) | [Download](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab103outta6StudentDictIntro.mp4) | [No Captions Available] * (4/6) Part 2 Overview [YouTube](https://youtu.be/JLSjNzxYPPU) | [Download](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab104outta6StudentDictOverview.mp4) | [Captions](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab104outta6StudentDictOverview.sbv) * (5/6) Part 2 Code Implementation [YouTube](https://youtu.be/CEfV_Qx3SUQ) | [Download](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab105outta6StudentDictsPythonCodeImplementation.mp4) | [Captions](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab105outta6StudentDictsPythonCodeImplementation.sbv) * (6/6) Summary: Dictionaries Recap [YouTube](https://youtu.be/sP6fqhfebzg) | [Download](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab106outta6DictionaryRecap.mp4) | [Captions](https://sakai.wellesley.edu/access/content/group/77109fc3-0650-48b0-aeb4-22c7e2e94cba/Lab%2010%3A%20Dictionaries/Lab106outta6DictionaryRecap.sbv) --}} @include('/labs/_setup', ['folder' => 'lab10']) ## Pair Programming Tips **1. Recognize that pairing is hard ** Pairing is an intense relationship, summoning all your powers of ingenuity, communication, humour, and code. If you find it hard, or even just tiring, it's because it is hard and tiring sometimes. It takes effort to be kind, patient and to help steer someone in the right direction (or to be willing to be steered). Respect your partner and be kind. Your job is to help each other learn. **2. Be mindful of your body language ** Is your back to your partner? Is your computer screen angled away? Do you make eye contact? You want to create an atmosphere of inclusion so your pair feels respected and encouraged to comment. ![An image showing good and bad body language for pair programming from a top-down viewpoint. Good body language involves two people sitting to the left and right of of a shared monitor. One has the keyboard, which is pulled off to the side towards them, and the line going through the middle of the monitor passes between the two people. This image is labeled 'yes' with a smiley face and the monitor middle line is green. The other image shows one person sitting directly in front of the monitor, with the monitor middle line (in red) going through them. The other person is forced to sit off to the side with an indirect view of the screen. This image is labeled 'no' with an unhappy face.](body-language-pairing_orig.png) **3. Is it too quiet between you and your partner?** If there is a lot of silence, that is often a sign that someone feels left behind. Did you take over the keyboard and write a bunch of lines in silence? Yikes! Explain what you type to your partner. Or perhaps you are confused but feel uncomfortable speaking up. Try: "I don't understand this line, can you explain what it does?"
(These tips are from [this blog post on pair programming](https://paulamuldoon.com/2018/11/24/10-tips-for-great-pair-programming/)) @include('/labs/lab10/_toc') ## Big Questions {.bigqs} - **Why would you want to use a dictionary of key/value pairs instead of just a list of key/value tuples?**
Show Answer The main advantage of a dictionary over a list is that you can quickly look up values according to their key. So any situation where you want to be able to look things up not by order (lists are fine if you just want to sort things) but arbitrarily by an associated value, a dictionary makes sense. For example, a dictionary with state names as keys and state capitol names as values would let you look up the capitol city of any state quickly, whereas doing that with a list would be less convenient.
- **Why are tuples useful in the context of dictionaries?**
Show Answer For most things, a list can simply be used instead of a tuple. But because dictionaries require their keys to be immutable, a list cannot be used as the key of a dictionary, whereas a tuple can be.
@stop