diff options
Diffstat (limited to 'getting_started_with_lists/quickref.tex')
-rw-r--r-- | getting_started_with_lists/quickref.tex | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/getting_started_with_lists/quickref.tex b/getting_started_with_lists/quickref.tex new file mode 100644 index 0000000..bfe61ef --- /dev/null +++ b/getting_started_with_lists/quickref.tex @@ -0,0 +1,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) |} |