manipulating-lists/quickref.tex
author anand
Thu, 11 Nov 2010 00:03:57 +0530
changeset 472 fcdec2d28c9a
parent 423 0f0f4993cffe
permissions -rw-r--r--
Checklist OK for `The other kinds of plots`
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
423
0f0f4993cffe Changes to manipulating lists quickref.
Puneeth Chaganti <punchagan@fossee.in>
parents: 312
diff changeset
     1
Slicing \& Striding a list:\\
0f0f4993cffe Changes to manipulating lists quickref.
Puneeth Chaganti <punchagan@fossee.in>
parents: 312
diff changeset
     2
{\ex \lstinline|    A[start:stop:step]|} \lstinline|stop| excluded
312
8cb703eee88d Manipulating lists LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
423
0f0f4993cffe Changes to manipulating lists quickref.
Puneeth Chaganti <punchagan@fossee.in>
parents: 312
diff changeset
     4
Sorting a list:\\
0f0f4993cffe Changes to manipulating lists quickref.
Puneeth Chaganti <punchagan@fossee.in>
parents: 312
diff changeset
     5
{\ex \lstinline|    sorted(A)|} -- returns new list
0f0f4993cffe Changes to manipulating lists quickref.
Puneeth Chaganti <punchagan@fossee.in>
parents: 312
diff changeset
     6
{\ex \lstinline|    A.sort()|} -- in-place sort
312
8cb703eee88d Manipulating lists LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
423
0f0f4993cffe Changes to manipulating lists quickref.
Puneeth Chaganti <punchagan@fossee.in>
parents: 312
diff changeset
     8
Reversing a list:\\
0f0f4993cffe Changes to manipulating lists quickref.
Puneeth Chaganti <punchagan@fossee.in>
parents: 312
diff changeset
     9
{\ex \lstinline|    A[::-1]|} -- returns new list
0f0f4993cffe Changes to manipulating lists quickref.
Puneeth Chaganti <punchagan@fossee.in>
parents: 312
diff changeset
    10
{\ex \lstinline|    A.reverse()|} -- in-place reverse