# HG changeset patch # User Madhusudan.C.S # Date 1256541173 -19800 # Node ID 5f13be28532d41d7b457c3d744ca9119f86c5211 # Parent ddfd95133adca3a3537f7e47d2833f720a4a61a3# Parent db43a4dfd9dc1527dc5b6105b81e38d9366c320e Merged Puneeth and Madhu branches. diff -r db43a4dfd9dc -r 5f13be28532d day1/session3.tex --- a/day1/session3.tex Mon Oct 26 12:41:59 2009 +0530 +++ b/day1/session3.tex Mon Oct 26 12:42:53 2009 +0530 @@ -293,26 +293,25 @@ \end{frame} \begin{frame}[fragile] - \frametitle{Dictionary} + \frametitle{Dictionary - Building parsed data} \begin{itemize} - \item lists index: 0 \ldots n - \item dictionaries index using any hashable objects - \item d = \{ ``Hitchhiker's guide'' : 42, ``Terminator'' : ``I'll be back''\} - \item d[``Terminator''] => ``I'll be back'' - \item ``Terminator'' is called the key of \typ{d} - \item ``I'll be back'' is called the value of the key ``Terminator'' + \item Let the parsed data be stored in dictionary \typ{data} + \item \begin{lstlisting} +data = {} # is an empty dictionary +\end{lstlisting} + \item Index of a dictionary is called a \emph{key} + \item \emph{Keys} of \typ{data} are strings - region codes + \item Value of a \emph{key} can be any Python object \end{itemize} \end{frame} \begin{frame}[fragile] - \frametitle{Dictionary - Building parsed data} + \frametitle{Dictionary - Building parsed data...} \begin{itemize} - \item Let the parsed data be stored in dictionary \typ{data} - \item Keys of \typ{data} are strings - region codes - \item Value of the key is another dictionary. + \item In this problem let the value of a \emph{key} be another dictionary. \item This dictionary contains: \begin{itemize} - \item 'marks': A list of NumPy arrays + \item 'marks': A \emph{list} of NumPy arrays \item 'total': Total marks of each student \item 'P': Number of passes \item 'F': Number of failures @@ -330,8 +329,8 @@ fields = record.split(';') if fields[0] not in data: data[fields[0]] = { - 'marks': array([]), - 'total': array([]), + 'marks': [], + 'total': [], 'P': 0, 'F': 0, 'W': 0 @@ -401,5 +400,16 @@ \end{lstlisting} \end{frame} +\begin{frame}[fragile] + \frametitle{New Concepts} + \begin{itemize} + \item Dictionaries + \item Slicing lists + \item New type of conditional + \item NumPy arrays + \item Slicing NumPy arrays + \item NumPy array operations - square, average, sqrt + \end{itemize} +\end{frame} + \end{document} -