@@ -920,10 +920,13 @@ class negative_index_concatenation_exercise(VerbatimStep):
920920
921921You might realize that working with the last element via `x[len(x) - 1]` is a bit cumbersome.
922922The same can be achieved by `x[-1]`.
923- Similarly, the second to last element `x[len(x) - 2]`is equivalent to `x[-2]`, and so on.
923+ Similarly, the second to last element `x[len(x) - 2]`can be written as `x[-2]`, and so on.
924924Python allows us to count the index backwards too, starting at the last element with `-1`:
925925
926- # TODO: table goes here explaining negative indexing
926+ | Index | First elt. | Second elt. | Third elt. | ... | 2nd to last elt. | Last elt. |
927+ |-----------|------------|-------------|-------------|-----|------------------|------------|
928+ | Forwards | `0` | `1` | `2` | ... | `len(x) - 2` |`len(x) - 1`|
929+ | Backwards | `-len(x)` |`-len(x) + 1`|`-len(x) + 2`| ... | `-2` | `-1` |
927930
928931Next exercise:
929932
@@ -1124,7 +1127,10 @@ class mutation_string_append(VerbatimStep):
11241127Again these two methods also work on strings similar to how they work on lists.
11251128`index` returns the *beginning index* of the search word `'the'` in the longer string
11261129`'feed the dog and the cat'`, which is `5`.
1127- TODO: table goes here explaining string index
1130+
1131+ | 0 | 1 | 2 | 3 | 4 | **5** | 6 | 7 | 8 | ... |
1132+ | :--: | :--: | :--: | :--: | :--: | :---: | :--: | :--: | :--: | :--: |
1133+ | f | e | e | d | | **t** | h | e | | ... |
11281134
11291135Note that in most cases, methods which *modify a list in place* (`append`, `insert`, `remove`) merely return `None`,
11301136while the remaining functions/methods return a new useful value without changing the original argument.