diff options
author | Santosh G. Vattam | 2009-11-18 17:14:33 +0530 |
---|---|---|
committer | Santosh G. Vattam | 2009-11-18 17:14:33 +0530 |
commit | ff5db2c0dd214632f12c96320182c9564db5b150 (patch) | |
tree | bf70319f9d2029137eadb2b9ec9cab73a9fa4378 | |
parent | caa48945edb47d3d87159552dfc860a06e0fc2c2 (diff) | |
download | workshops-ff5db2c0dd214632f12c96320182c9564db5b150.tar.gz workshops-ff5db2c0dd214632f12c96320182c9564db5b150.tar.bz2 workshops-ff5db2c0dd214632f12c96320182c9564db5b150.zip |
Minor edits to cheatsheet session 2 day 1.
-rwxr-xr-x | day1/cheatsheet2.tex | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/day1/cheatsheet2.tex b/day1/cheatsheet2.tex index 06d806f..c80db4f 100755 --- a/day1/cheatsheet2.tex +++ b/day1/cheatsheet2.tex @@ -29,11 +29,11 @@ \section{Plotting Points with Lists} \begin{lstlisting} -In [1]: x = [0, 1, 2, 3] -In [2]: y = [7, 11, 15, 19] -In [3]: plot(x, y) -In [4]: clf() -In [5]: plot(x, y, 'o') # Plotting Circles +In []: x = [0, 1, 2, 3] +In []: y = [7, 11, 15, 19] +In []: plot(x, y) +In []: clf() +In []: plot(x, y, 'o') # Plotting Circles #Dots - '.', #Dashed lines - '--' #Lines - '-' \end{lstlisting} @@ -41,32 +41,31 @@ In [5]: plot(x, y, 'o') # Plotting Circles Initializing \begin{lstlisting} -In [10]: mtlist = [] # Empty List -In [11]: lst = [ 1, 2, 3, 4, 5] +In []: mtlist = [] # Empty List +In []: lst = [ 1, 2, 3, 4, 5] \end{lstlisting} Slicing \begin{lstlisting} -In [12]: lst[1:3] # A slice. -Out[12]: [2, 3] +In []: lst[1:3] # A slice. +Out[]: [2, 3] -In [13]: lst[1:-1] -Out[13]: [2, 3, 4] +In []: lst[1:-1] +Out[]: [2, 3, 4] \end{lstlisting} Appending to lists \begin{lstlisting} -In [14]: a = [ 6, 7, 8, 9] -In [15]: b = lst + a -In [16]: b -Out[16]: [1, 2, 3, 4, 5, 6, 7, 8, 9] +In []: a = [ 6, 7, 8, 9] +In []: b = lst + a +In []: b +Out[]: [1, 2, 3, 4, 5, 6, 7, 8, 9] -In [17]: lst.append(6) -In [18]: lst -Out[18]: [ 1, 2, 3, 4, 5, 6] +In []: lst.append(6) +In []: lst +Out[]: [ 1, 2, 3, 4, 5, 6] \end{lstlisting} - Iterating over a List \begin{lstlisting} -In [19]: for each in b: # Iterating over the list, element-wise +In []: for each in b: # Iterating over the list, element-wise ....: print b # Print each element ....: \end{lstlisting} |