::: {#navbar .navbar .navbar-default .navbar-fixed-top role="navigation"}
::: {.container}
::: {.navbar-header}
[]{.icon-bar} []{.icon-bar} []{.icon-bar}

<div>

[![](../_static/img/RAIcon.png)](/runestone/default/user/login){.brand-logo}
[fopp](../index.html){#rs-book-toc-link .navbar-brand}

</div>
:::

::: {.navbar-collapse .collapse .navbar-ex1-collapse}
-   
-   []{#ad_warning}
-   []{#browsing_warning}
-   
-   [*[Search]{.visuallyhidden
    aria-label="Search"}*](#){.dropdown-toggle}
    -   [Table of Contents](../index.html)

    -   [Book Index](../genindex.html)

    -   

    -   ::: {.input-group}
        :::
-   
-   [*[User]{.visuallyhidden aria-label="User"}*](#){.dropdown-toggle}
    -   []{.loggedinuser}

    -   

    -   [Course Home](/ns/course/index)

    -   [Assignments](/assignment/student/chooseAssignment)

    -   [Practice](/runestone/assignments/practice)

    -   [[Peer Instruction
        (Instructor)](/runestone/peer/instructor.html)]{#inst_peer_link}

    -   [Peer Instruction (Student)](/runestone/peer/student.html)

    -   

    -   [Change Course](/runestone/default/courses)

    -   

    -   [[Instructor\'s
        Page](/runestone/admin/index)]{#ip_dropdown_link}

    -   [Progress Page](/runestone/dashboard/studentreport)

    -   

    -   [Edit Profile](/runestone/default/user/profile){#profilelink}

    -   [Change
        Password](/runestone/default/user/change_password){#passwordlink}

    -   [Register](/runestone/default/user/register){#registerlink}

    -   [Login](#)

    -   ::: {.slider .round}
        :::

        Dark Mode
-   
-   [[*[Scratch Activecode]{.visuallyhidden
    aria-label="Scratch Activecode"}*](javascript:runestoneComponents.popupScratchAC())]{#scratch_ac_link}
-   
-   [*[Help]{.visuallyhidden aria-label="Help"}*](#){.dropdown-toggle}
    -   [FAQ](http://runestoneinteractive.org/pages/faq.html)
    -   [Instructors Guide](https://guide.runestone.academy)
    -   
    -   [About Runestone](http://runestoneinteractive.org)
    -   [Report A
        Problem](/runestone/default/reportabug?course=fopp&page=ChapterAssessment)
-   

```{=html}
<!-- -->
```
-   
-   [This Chapter](../index.html){.dropdown-toggle}
    -   [17.1 Introduction: Nested Data and Nested
        Iteration](ListswithComplexItems.html){.reference .internal}
    -   [17.2 Nested Dictionaries](NestedDictionaries.html){.reference
        .internal}
    -   [17.3 Processing JSON results](jsonlib.html){.reference
        .internal}
    -   [17.4 Nested Iteration](NestedIteration.html){.reference
        .internal}
    -   [17.5 👩‍💻 Structuring Nested
        Data](WPStructuringNestedData.html){.reference .internal}
    -   [17.6 Deep and Shallow
        Copies](DeepandShallowCopies.html){.reference .internal}
    -   [17.7 👩‍💻 Extracting from Nested
        Data](WPExtractFromNestedData.html){.reference .internal}
    -   [17.8 Exercises](Exercises.html){.reference .internal}
    -   [17.9 Chapter Assessment](ChapterAssessment.html){.reference
        .internal}
-   
-   
:::
:::
:::

::: {#continue-reading .container}
:::

::: {#main-content .container role="main"}
::: {#chapter-assessment .section}
[17.9. ]{.section-number}Chapter Assessment[¶](#chapter-assessment "Permalink to this heading"){.headerlink}
============================================================================================================

::: {.runestone .explainer .ac_section}
::: {#ac17_6_1 component="activecode" question_label="17.9.1"}
::: {#ac17_6_1_question .ac_question}
The variable `nested`{.docutils .literal .notranslate} contains a nested
list. Assign 'snake' to the variable `output`{.docutils .literal
.notranslate} using indexing.
:::
:::
:::

::: {.runestone .explainer .ac_section}
::: {#ac17_6_2 component="activecode" question_label="17.9.2"}
::: {#ac17_6_2_question .ac_question}
Below, a list of lists is provided. Use in and not in tests to create
variables with Boolean values. See comments for further instructions.
:::
:::
:::

::: {.runestone .explainer .ac_section}
::: {#ac17_6_3 component="activecode" question_label="17.9.3"}
::: {#ac17_6_3_question .ac_question}
Below, we've provided a list of lists. Use in statements to create
variables with Boolean values - see the ActiveCode window for further
directions.
:::
:::
:::

::: {.runestone .explainer .ac_section}
::: {#ac17_6_4 component="activecode" question_label="17.9.4"}
::: {#ac17_6_4_question .ac_question}
Provided is a nested data structure. Follow the instructions in the
comments below. Do not hard code.
:::
:::
:::

::: {.runestone .explainer .ac_section}
::: {#ac17_6_5 component="activecode" question_label="17.9.5"}
::: {#ac17_6_5_question .ac_question}
The variable `nested_d`{.docutils .literal .notranslate} contains a
nested dictionary with the gold medal counts for the top four countries
in the past three Olympics. Assign the value of Great Britain's gold
medal count from the London Olympics to the variable
`london_gold`{.docutils .literal .notranslate}. Use indexing. Do not
hardcode.
:::
:::
:::

::: {.runestone .explainer .ac_section}
::: {#ac17_6_6 component="activecode" question_label="17.9.6"}
::: {#ac17_6_6_question .ac_question}
Below, we have provided a nested dictionary. Index into the dictionary
to create variables that we have listed in the ActiveCode window.
:::
:::
:::

::: {.runestone .explainer .ac_section}
::: {#ac17_6_7 component="activecode" question_label="17.9.7"}
::: {#ac17_6_7_question .ac_question}
Given the dictionary, `nested_d`{.docutils .literal .notranslate}, save
the medal count for the USA from all three Olympics in the dictionary to
the list `US_count`{.docutils .literal .notranslate}.
:::
:::
:::

::: {.runestone .explainer .ac_section}
::: {#ac17_6_8 component="activecode" question_label="17.9.8"}
::: {#ac17_6_8_question .ac_question}
Iterate through the contents of `l_of_l`{.docutils .literal
.notranslate} and assign the third element of sublist to a new list
called `third`{.docutils .literal .notranslate}.
:::
:::
:::

::: {.runestone .explainer .ac_section}
::: {#ac17_6_9 component="activecode" question_label="17.9.9"}
::: {#ac17_6_9_question .ac_question}
Given below is a list of lists of athletes. Create a list, `t`{.docutils
.literal .notranslate}, that saves only the athlete's name if it
contains the letter "t". If it does not contain the letter "t", save the
athlete name into list `other`{.docutils .literal .notranslate}.
:::
:::
:::
:::

::: {style="width: 100%"}
::: {ea-publisher="runestoneacademy" ea-type="image" style="display: flex; justify-content: center"}
:::
:::

::: {#scprogresscontainer}
You have attempted []{#scprogresstotal} of []{#scprogressposs}
activities on this page

::: {#subchapterprogress aria-label="Page progress"}
:::
:::

-   [[](Exercises.html)]{#relations-prev}
-   [[](../TestCases/toctree.html)]{#relations-next}
:::

::: {.container}
[]{#numuserspan}[]{.loggedinuser} \| [Back to top](#)

© Copyright 2017 bradleymiller. Created using
[Runestone](http://runestoneinteractive.org/) 7.2.10.
:::
