summaryrefslogtreecommitdiff
path: root/getting-started-with-lists/quickref.tex
blob: bfe61efe191120f410d59f5d067380e9f0fffc68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Creating an list\\
{\ex \lstinline| empty=[]|}

Create a filled list\\
{\ex \lstinline| nonempty = ['spam', 'eggs', 100, 1.234]  |}

Accessing a list\\
{\ex \lstinline|    nonempty[0] |}
{\ex \lstinline|    nonempty[-1] |}

Length of a list\\
{\ex \lstinline|    len(nonempty) |}

Append an element to a list\\
{\ex \lstinline|    nonempty.append('python') |}

Remove elements of a list\\
{\ex \lstinline|    del(nonempty[1] |}
{\ex \lstinline|  nonempty.remove(100) |}