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
What is the keyword for eliminating a list element by specifying its index number? | del | ^ *del *$ | |
What is the keyword for eliminating a list element by specifying its value? | remove | ^ *remove *$ | |
Eliminate the element with an index of 2 from a list whose name is products. | del products[2] | del `products`[`2`] | |
Eliminate "lamp" from the products list. | products.remove("lamp") | products.remove("lamp") | |
Eliminate "lamp" from the list using its index number. | products = ["chair", "table", "lamp", "rug", "couch"] | del products[2] | ^ *del products\[2\] *$ |
Eliminate "chair" from the list using its value. | products = ["chair", "table", "lamp", "rug", "couch"] | products.remove("chair") | ^ *products\.remove\(•chair•\) *$ |
Eliminate an element from a list using its index number. Make up the list name and index number. | del computers[2] | ^ *del [a-zA-Z_][a-zA-Z0-9_]*\[[0-9]*\] *$ | |
Using remove, eliminate a string element from a list using its value. Make up the list name and the value. | pets.remove("snake") | ^ *[a-zA-Z_][a-zA-Z0-9_]*\.remove\(•.*•\) *$ | |
On one line add a string to the end of a list using the append keyword. On the next line eliminate it by specifying its value. Make up the string and the name of the list. | streets.append("Main") streets.remove("Main") | ^ *([a-zA-Z_][a-zA-Z0-9_]*)\.append\(•(.*)•\)\n\1\.remove\(•\2•\) *$ | |
Eliminate "rose" by specifying its index number. | flowers = ["hyacinth", "tulip", "lotus", "rose", "geranium"] | del flowers[3] | ^ *del flowers\[3\] *$ |
| 9819320b44 | ||
| cad6057a35 |