manipulating-lists/quickref.tex
changeset 423 0f0f4993cffe
parent 312 8cb703eee88d
equal deleted inserted replaced
422:f29d9014e1fc 423:0f0f4993cffe
     1 Creating a linear array:\\
     1 Slicing \& Striding a list:\\
     2 {\ex \lstinline|    x = linspace(0, 2*pi, 50)|}
     2 {\ex \lstinline|    A[start:stop:step]|} \lstinline|stop| excluded
     3 
     3 
     4 Plotting two variables:\\
     4 Sorting a list:\\
     5 {\ex \lstinline|    plot(x, sin(x))|}
     5 {\ex \lstinline|    sorted(A)|} -- returns new list
       
     6 {\ex \lstinline|    A.sort()|} -- in-place sort
     6 
     7 
     7 Plotting two lists of equal length x, y:\\
     8 Reversing a list:\\
     8 {\ex \lstinline|    plot(x, y)|}
     9 {\ex \lstinline|    A[::-1]|} -- returns new list
       
    10 {\ex \lstinline|    A.reverse()|} -- in-place reverse