Skip to content

Commit 3af8aea

Browse files
committed
corrects indexing/slicing of nested list
1 parent a2bcfc2 commit 3af8aea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

python2.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,9 @@ nested_list
343343
Indexing and slicing also work for nested lists:
344344

345345
```python
346-
nested_list[1]
347-
nested_list[1][2]
348-
nested_list[2][2:6]
346+
nested_list[2]
347+
nested_list[2][1]
348+
nested_list[2][1:3]
349349
```
350350

351351
Since lists are [objects](python3.qmd#object-oriented-programming), they may be manipulated by special functions called *methods*. Methods are called like functions, but refer to a given object. Thus, the syntax for calling a method is as follows:

0 commit comments

Comments
 (0)