Use `del` to remove a list item or slice, a dictionary entry, or a variable name. What disappears depends on the target: deleting a name does not necessarily delete the object it referred to. section 5.3 section 7.2 section 4.3
Delete by list position
Start with `x = ['a', 2, 'c', 7, 9, 11]`. After `del x[1]`, `x` is `['a', 'c', 7, 9, 11]`. Then `del x[:2]` leaves `[7, 9, 11]`. For lists, `del x[n]` has the effect of `x[n:n+1] = []`, and `del x[m:n]` has the effect of `x[m:n] = []`. `del` is usually easier to read. section 5.3
To remove a dictionary key-value pair, use its key: `del english_to_french['green']` removes the `'green'` entry. This differs from list deletion by position; `list.remove(value)` instead searches for the first matching list value. section 7.2 section 5.3
To delete a variable name, write `del x`. If `x = 5` beforehand, a subsequent `print(x)` raises `NameError` because `x` is no longer defined. Deleting the name does not necessarily destroy its former object. section 4.3
