equal
deleted
inserted
replaced
142 \begin{frame}[fragile] |
142 \begin{frame}[fragile] |
143 \frametitle{Acceleration due to gravity - ``g''\ldots} |
143 \frametitle{Acceleration due to gravity - ``g''\ldots} |
144 \begin{lstlisting} |
144 \begin{lstlisting} |
145 In []: G = [] |
145 In []: G = [] |
146 In []: for line in open('pendulum.txt'): |
146 In []: for line in open('pendulum.txt'): |
147 .... points = line.split() |
147 .... point = line.split() |
148 .... l = float(points[0]) |
148 .... l = float(point[0]) |
149 .... t = float(points[1]) |
149 .... t = float(point[1]) |
150 .... g = 4 * pi * pi * l / t * t |
150 .... g = 4 * pi * pi * l / t * t |
151 .... G.append(g) |
151 .... G.append(g) |
152 \end{lstlisting} |
152 \end{lstlisting} |
153 \end{frame} |
153 \end{frame} |
154 |
154 |
164 \begin{lstlisting} |
164 \begin{lstlisting} |
165 total = 0 |
165 total = 0 |
166 for g in G: |
166 for g in G: |
167 total += g |
167 total += g |
168 |
168 |
169 mean_g = total / len(g) |
169 g_mean = total / len(g) |
170 print "Mean: ", mean_g |
170 print "Mean: ", g_mean |
171 \end{lstlisting} |
171 \end{lstlisting} |
172 \end{frame} |
172 \end{frame} |
173 |
173 |
174 \begin{frame}[fragile] |
174 \begin{frame}[fragile] |
175 \frametitle{Mean ``g''} |
175 \frametitle{Mean ``g''} |
176 \begin{lstlisting} |
176 \begin{lstlisting} |
177 mean_g = sum(G) / len(G) |
177 g_mean = sum(G) / len(G) |
178 print "Mean: ", mean_g |
178 print "Mean: ", g_mean |
179 \end{lstlisting} |
179 \end{lstlisting} |
180 \end{frame} |
180 \end{frame} |
181 |
181 |
182 \begin{frame}[fragile] |
182 \begin{frame}[fragile] |
183 \frametitle{Mean ``g''} |
183 \frametitle{Mean ``g''} |
184 \begin{lstlisting} |
184 \begin{lstlisting} |
185 mean_g = mean(G) |
185 g_mean = mean(G) |
186 print "Mean: ", mean_g |
186 print "Mean: ", g_mean |
187 \end{lstlisting} |
187 \end{lstlisting} |
188 \inctime{10} |
188 \inctime{10} |
189 \end{frame} |
189 \end{frame} |
190 |
190 |
191 \section{Processing voluminous data} |
191 \section{Processing voluminous data} |
246 \frametitle{Machinery Required} |
246 \frametitle{Machinery Required} |
247 \begin{itemize} |
247 \begin{itemize} |
248 \item File reading |
248 \item File reading |
249 \item Parsing |
249 \item Parsing |
250 \item Dictionaries |
250 \item Dictionaries |
251 \item List enumeration |
|
252 \item Arrays |
251 \item Arrays |
253 \item Statistical operations |
252 \item Statistical operations |
254 \end{itemize} |
253 \end{itemize} |
255 \end{frame} |
254 \end{frame} |
256 |
255 |
319 \end{lstlisting} |
318 \end{lstlisting} |
320 \begin{itemize} |
319 \begin{itemize} |
321 \item Keys will be region codes |
320 \item Keys will be region codes |
322 \item Values will be the number students who scored more than 90\% in that region |
321 \item Values will be the number students who scored more than 90\% in that region |
323 \end{itemize} |
322 \end{itemize} |
|
323 \begin{block}{Sample \emph{science} dictionary} |
|
324 \{'A': 729, 'C': 764, 'B': 1120,'E': 414, 'D': 603, 'F': 500\} |
|
325 \end{block} |
|
326 |
324 \end{frame} |
327 \end{frame} |
325 |
328 |
326 \begin{frame}[fragile] |
329 \begin{frame}[fragile] |
327 \frametitle{Building parsed data \ldots} |
330 \frametitle{Building parsed data \ldots} |
328 \begin{lstlisting} |
331 \begin{lstlisting} |