manipulating-lists/quickref.tex
author bhanu
Thu, 11 Nov 2010 03:00:24 +0530
changeset 480 42f7aa36f1bc
parent 423 0f0f4993cffe
permissions -rw-r--r--
language check done for `getting started with functions`
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