small medium large xlarge

# Storing Collections of Data Using Lists

2. a. `kingdoms[-6]`
b. `kingdoms[-1]`
c. `kingdoms[-6:-3]`
d. `kingdoms[-4:-1]`
e. `kingdoms[-2:]`
f. `kingdoms[-1:-2]` (many other solutions)

4. a. `ids.remove(3382)`
b. `ids.index(9362)`
c. `ids.insert(ids.index(9362) + 1, 4499)`
d. `ids = ids + [5566, 1830]` or:

```ids.append(5566)
ids.append(1830)
```
e. ```ids.reverse() f. <code>ids.sort() 6. a. <code>temps = [25.2, 16.8, 31.4, 23.9, 28, 22.5, 19.6]</code><br/> b. <code>temps.sort()</code><br/> c. <pre> cool_temps = temps[0:2] warm_temps = temps[2:] </pre> d. <code>temps_in_celsius = cool_temps + warm_temps</code><br/> 8. <pre> def is_longer(L1, L2): """ (list, list) -> bool Return True if and only if the length of L1 is longer than the length of L2. >>> is_longer([1, 2, 3], [4, 5]) True >>> is_longer(['abcdef'], ['ab', 'cd', 'ef']) False >>> is_longer(['a', 'b', 'c'], [1, 2, 3]) False """ return len(L1) > len(L2) </pre> 10. a. <code>units[0]</code><br/> b. <code>units[-1]</code> or <code>units[1]</code><br/> c. <code>units[0][0]</code><br/> d. <code>units[1][0]</code><br/> e. <code>units[0][1:]</code><br/> f. <code>units[1][0:2]</code><br/> ```
``` Page History V3: Jason Montojo [over 4 years ago] V2: Jason Montojo [over 4 years ago] V1: Jason Montojo [over 4 years ago] ```
``` ```
``` ```
``` ```
``` Added to your cart ```
``` ```
``` ```
``` Customer Service Contact Privacy Legal Become an Author Security Menu Categories Screencasts Video Courses Magazine Articles Forums Help Wanted Promotions About Login © 1999–2018 The Pragmatic Programmers, LLC ```