day2/cheatsheet2.tex
changeset 329 0a6ab1d81491
parent 327 c78cad28c2f7
child 330 46533051b9d3
--- a/day2/cheatsheet2.tex	Tue Dec 08 12:40:07 2009 +0530
+++ b/day2/cheatsheet2.tex	Tue Dec 08 13:06:14 2009 +0530
@@ -40,23 +40,23 @@
     statement1
     statement2
 \end{lstlisting}
-All the statements are executed, till the condition statement evaluates to True.
+All statements are executed, till the condition statement evaluates to True.
 \subsection{\typ{for} and \typ{range}}
 \typ{range(start, stop, step)}\\
 returns a list containing an arithmetic progression of integers.\\
 Of the arguments mentioned above, both start and step are optional.\\
-For example, if we skip third argument, i.e \typ{step}, then default value is 1. So:
+For example, if we skip third argument, i.e \typ{step}, default is taken as 1. So:
 \begin{lstlisting}
 In []: range(1,10)
 Out[]: [1, 2, 3, 4, 5, 6, 7, 8, 9]
 \end{lstlisting}
 \textbf{Note:} stop value is not included in the list.\\
-Similarly if we don't pass \typ{start} argument, default is taken to be 0.
+Similarly if we don't pass \typ{first} argument (in this case \typ{start}), default is taken to be 0.
 \begin{lstlisting}
 In []: range(10)
 Out[]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 \end{lstlisting}
-In case \typ{step} is mentioned, the jump between consecutive members of the list would be equal to that.
+In case third argument is mentioned(\typ{step}), the jump between consecutive members of the list would be equal to that.
 \begin{lstlisting}
 In []: range(1,10,2)
 Out[]: [1, 3, 5, 7, 9]
@@ -94,14 +94,14 @@
 In []: num[-1]
 Out[]: 4
 \end{lstlisting}
-\textbf{Note: }\typ{-1} points the last element in a list. Similarly to access third last element of a list one can use: 
+\textbf{Note: }\typ{-1} points to last element in a list. Similarly to access third last element of a list one can use: 
 \begin{lstlisting}
 In []: num[-3]
 Out[]: 2  
 \end{lstlisting}
-\subsection{Adding lists and elements}
+\subsection{\typ{list} operations}
 \begin{lstlisting}
-In []: num += [9, 10, 11] # Adding two lists
+In []: num += [9, 10, 11] # Concatenating two lists
 In []: num
 Out[]: [1, 2, 3, 4, 9, 10, 11]
 \end{lstlisting}
@@ -162,7 +162,7 @@
 In []: a[::2]
 Out[]: [1, 3, 5]
 \end{lstlisting}
-Start from beginning(since \typ{initial} is blank), till last of list(this time last element is included, as \typ{final} is blank), with step size of 2.\\
+Start from beginning(since \typ{initial} is blank), till last(this time last element is included, as \typ{final} is blank), with step size of 2.\\
 Apart from using \typ{reverse} command on list, one can also use slicing in special way to get reverse of a list.
 \begin{lstlisting}
 In []: a[-1:-4:-1]
@@ -228,13 +228,13 @@
 Out[21]: {'Avg': 52.530000000000001, 'Inn': 233, 
           'Name': 'Rahul Dravid', 'Runs': 10823}
 \end{lstlisting}
-\textbf{Note:} Duplicate keys are overwritten!\\
 \begin{lstlisting}
 In []: player['Name'] = 'Dravid'
 In []: player
 Out[23]: {'Avg': 52.530000000000001, 'Inn': 233, 
           'Name': 'Dravid', 'Runs': 10823}
 \end{lstlisting}
+\textbf{Note:} Duplicate keys are overwritten!
 \subsection{containership}
 \begin{lstlisting}
 In []: 'Inn' in player
@@ -242,7 +242,7 @@
 In []: 'Econ' in player
 Out[]: False
 \end{lstlisting}
-\textbf{Note:} Containership is always checked on 'keys' of dictionary but not 'values'.\\
+\textbf{Note:} Containership is always checked on 'keys' of dictionary, never on 'values'.\\
 \subsection{Methods}
 \begin{lstlisting}
 In []: player.keys() # returns list of all keys
@@ -279,4 +279,3 @@
 Out[]: True
 \end{lstlisting}
 \end{document}
-