equal
deleted
inserted
replaced
|
1 Creating an list\\ |
|
2 {\ex \lstinline| empty=[]|} |
|
3 |
|
4 Create a filled list\\ |
|
5 {\ex \lstinline| nonempty = ['spam', 'eggs', 100, 1.234] |} |
|
6 |
|
7 Accessing a list\\ |
|
8 {\ex \lstinline| nonempty[0] |} |
|
9 {\ex \lstinline| nonempty[-1] |} |
|
10 |
|
11 Length of a list\\ |
|
12 {\ex \lstinline| len(nonempty) |} |
|
13 |
|
14 Append an element to a list\\ |
|
15 {\ex \lstinline| nonempty.append('python') |} |
|
16 |
|
17 Remove elements of a list\\ |
|
18 {\ex \lstinline| del(nonempty[1] |} |
|
19 {\ex \lstinline| nonempty.remove(100) |} |