17.9. Chapter Assessment

The variable nested contains a nested list. Assign ‘snake’ to the variable output using indexing.

Below, a list of lists is provided. Use in and not in tests to create variables with Boolean values. See comments for further instructions.

Below, we’ve provided a list of lists. Use in statements to create variables with Boolean values - see the ActiveCode window for further directions.

Provided is a nested data structure. Follow the instructions in the comments below. Do not hard code.

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.

Before you keep reading...

Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.

Below, we have provided a nested dictionary. Index into the dictionary to create variables that we have listed in the ActiveCode window.

Given the dictionary, nested_d, save the medal count for the USA from all three Olympics in the dictionary to the list US_count.

Iterate through the contents of l_of_l and assign the third element of sublist to a new list called third.

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 1 of 10 activities on this page