Skip to main content
Contents
Dark Mode Prev Up Next Scratch ActiveCode Profile
\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 10.7 Chapter Assessment
Checkpoint 10.7.1 .
The variable
nested
contains a nested list. Assign βsnakeβ to the variable
output
using indexing.
Checkpoint 10.7.2 .
Below, a list of lists is provided. Use in and not in tests to create variables with Boolean values. See comments for further instructions.
Checkpoint 10.7.3 .
Below, weβve provided a list of lists. Use in statements to create variables with Boolean values - see the ActiveCode window for further directions.
Checkpoint 10.7.4 .
Provided is a nested data structure. Follow the instructions in the comments below. Do not hard code.
Checkpoint 10.7.5 .
The variable
nested_d
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
. Use indexing. Do not hardcode.
Checkpoint 10.7.6 .
Below, we have provided a nested dictionary. Index into the dictionary to create variables that we have listed in the ActiveCode window.
Checkpoint 10.7.7 .
Given the dictionary,
nested_d
, save the medal count for the USA from all three Olympics in the dictionary to the list
US_count
.
Checkpoint 10.7.8 .
Iterate through the contents of
l_of_l
and assign the third element of sublist to a new list called
third
.
Checkpoint 10.7.9 .
Given below is a list of lists of athletes. Create a list,
t
, 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
.
You have attempted
of
activities on this page.