1
2
3
4
5
6
7
8
9
10
11
12
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to Trinket.
Post a review on Amazon for the paperback or the Kindle edition.
Email me to give me a compliment, complaint, or correction. I'll respond.
0,1,2,3,4,5,6,7,8,9,10,11
0
0
0
0
Complete the line to begin coding a list of dictionaries. (3 characters) | customers _____ | = [ | ^ *= \[ *$ |
The name of the list of dictionaries is customers. Code the first line. | customers = [ | ^ *customers = \[ *$ | |
The name of the list of dictionaries is list_of_dictionaries. Code the first line. | list_of_dictionaries = [ | list_of_dictionaries `= `[ | |
Code the second line. Remember to indent it. | products = [ | { | { |
Code the first three lines of a list of dictionaries. Its keys and values are strings. Make up the other names. Remember to indent correctly and add a comma after the key-value pair. | things_i_love = [ { "fish": "Sam", |
^ *[a-zA-Z_][a-zA-Z0-9_]* = \[\n {\n •.+•: •.+•, *$ | |
Code the first three lines of a list of dictionaries. The dictionary's keys and values are numbers. Make everything else up. | combos = [ { 12: 144, |
^ *[a-zA-Z_][a-zA-Z0-9_]* = \[\n {\n -?[0-9]+: -?[0-9]+, *$ | |
Code the first three lines of a list of dictionaries. The dictionary's keys are strings and its values are numbers. Make everything else up. | stats = [ { "China": 2, |
^ *[a-zA-Z_][a-zA-Z0-9_]* = \[\n {\n •.+•: [-]?(?:[.]\d+|\d+(?:[.]\d*)?), *$ | |
I've coded the first line of a list of dictionaries. Code the first dictionary in the list. It has just two items. Both keys and values are strings. Make everything up. Remember to indent correctly. Remember to include the comma at the end. | performers = [ | { "pianist": "Serkin", "violinist": "Hahn", }, |
^ * {\n •.+•: •.+•,\n •.+•: •.+•,\n }, *$ |
I've coded the first line of a list of dictionaries. Code the first dictionary in the list. It has just two items. Keys are numbers, values are strings. Make everything up. Remember to include the comma at the end. | ranks = [ | { 1: "Ho", 2: "Park", }, |
^ * {\n -?[0-9]+: •.+•,\n -?[0-9]+: •.+•,\n }, *$ |
Code a list containing two dictionaries. Each dictionary has two key-value pairs. All keys and values are numbers. Make everything up. | relationships = [ { 4: 16, 3: 9, }, { 50: 100, 100: 200, }, ] |
^ *[a-zA-Z_][a-zA-Z0-9_]* = \[\n {\n -?[0-9]+: -?[0-9]+,\n -?[0-9]+: -?[0-9]+,\n },\n {\n -?[0-9]+: -?[0-9]+,\n -?[0-9]+: -?[0-9]+,\n },\n\] *$ | |
|
f812da803b | ||
|
bd9bb20763 |