@@ -59,7 +59,7 @@ positive and negative number for the index.
59
59
### Modifying
60
60
61
61
Lists are * mutable* . This means that once created, you can change their
62
- contents and Python will just work with the updated list. You can add to a
62
+ contents and Python will just work with the updated list. You can change a
63
63
list a number of ways:
64
64
65
65
* Setting a value in the list explicitly with ` [n] ` where ` n ` is the index you
@@ -74,9 +74,9 @@ for a more complete reference:
74
74
>>> places_to_visit
75
75
['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand']
76
76
77
- >>> places_to_visit[5 ] = "Peru"
77
+ >>> places_to_visit[1 ] = "Peru"
78
78
>>> places_to_visit
79
- ['Mexico', 'Portugal ', 'Kenya', 'Nepal', 'New Zealand', 'Peru ']
79
+ ['Mexico', 'Peru ', 'Kenya', 'Nepal', 'New Zealand']
80
80
81
81
>>> places_to_visit.pop()
82
82
'Peru'
@@ -89,8 +89,7 @@ for a more complete reference:
89
89
90
90
Try some of these out yourself:
91
91
92
- * Try adding a country to a list with either the explicit indexing (` [n] ` ) or
93
- ` .append() ` . What happens if you give an index that's larger than the list?
92
+ * Try adding a country to a list with ` .append() ` .
94
93
* Take a look at the documentation and try out some of the other methods.
95
94
` .count() ` is a simple one, and ` .reverse() ` is handy to know.
96
95
0 commit comments