From ea8e24ac702226c4d189fcef264b7ed2388268c4 Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Thu, 21 Jan 2010 15:26:11 +0530 Subject: Added files to be circulated during workshops. --- day1/session3.tex | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'day1/session3.tex') diff --git a/day1/session3.tex b/day1/session3.tex index 2de2634..567a12c 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -162,28 +162,29 @@ In []: for line in open('pendulum.txt'): \begin{frame}[fragile] \frametitle{Mean ``g''} \begin{lstlisting} -total = 0 -for g in G: - total += g +In []: total = 0 +In []: for g in G: + ....: total += g + ....: -g_mean = total / len(G) -print 'Mean: ', g_mean +In []: g_mean = total / len(G) +In []: print 'Mean: ', g_mean \end{lstlisting} \end{frame} \begin{frame}[fragile] \frametitle{Mean ``g''} \begin{lstlisting} -g_mean = sum(G) / len(G) -print 'Mean: ', g_mean +In []: g_mean = sum(G) / len(G) +In []: print 'Mean: ', g_mean \end{lstlisting} \end{frame} \begin{frame}[fragile] \frametitle{Mean ``g''} \begin{lstlisting} -g_mean = mean(G) -print 'Mean: ', g_mean +In []: g_mean = mean(G) +In []: print 'Mean: ', g_mean \end{lstlisting} \inctime{10} \end{frame} -- cgit From 9df774c69643bf42c22a4c57435ff0fc7ccdaeb0 Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Thu, 21 Jan 2010 17:14:52 +0530 Subject: Fixed errors found during REC workshop. --- day1/session3.tex | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'day1/session3.tex') diff --git a/day1/session3.tex b/day1/session3.tex index 567a12c..135bfc1 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -142,13 +142,13 @@ \begin{frame}[fragile] \frametitle{Acceleration due to gravity - ``g''\ldots} \begin{lstlisting} -In []: G = [] +In []: g_list = [] In []: for line in open('pendulum.txt'): .... point = line.split() .... l = float(point[0]) .... t = float(point[1]) .... g = 4 * pi * pi * l / (t * t) - .... G.append(g) + .... g_list.append(g) \end{lstlisting} \end{frame} @@ -163,11 +163,11 @@ In []: for line in open('pendulum.txt'): \frametitle{Mean ``g''} \begin{lstlisting} In []: total = 0 -In []: for g in G: +In []: for g in g_list: ....: total += g ....: -In []: g_mean = total / len(G) +In []: g_mean = total / len(g_list) In []: print 'Mean: ', g_mean \end{lstlisting} \end{frame} @@ -175,7 +175,7 @@ In []: print 'Mean: ', g_mean \begin{frame}[fragile] \frametitle{Mean ``g''} \begin{lstlisting} -In []: g_mean = sum(G) / len(G) +In []: g_mean = sum(g_list) / len(g_list) In []: print 'Mean: ', g_mean \end{lstlisting} \end{frame} @@ -183,7 +183,7 @@ In []: print 'Mean: ', g_mean \begin{frame}[fragile] \frametitle{Mean ``g''} \begin{lstlisting} -In []: g_mean = mean(G) +In []: g_mean = mean(g_list) In []: print 'Mean: ', g_mean \end{lstlisting} \inctime{10} @@ -333,7 +333,6 @@ science = {} science = {} for record in open('sslc1.txt'): - record = record.strip() fields = record.split(';') region_code = fields[0].strip() @@ -396,7 +395,6 @@ savefig('science.png') math_scores = [] for record in open('sslc1.txt'): - record = record.strip() fields = record.split(';') score_str = fields[5].strip() -- cgit