summaryrefslogtreecommitdiff
path: root/day1
diff options
context:
space:
mode:
authorChristopher Burns2010-06-27 15:16:54 -0500
committerChristopher Burns2010-06-27 15:16:54 -0500
commit2246b4f9af4843cda97898b960ed4c9cd1136052 (patch)
tree7ca6e39dcfe4642dc4a7726c2f19cf302adc0176 /day1
parent403587de81d3b6263d7b250a1800ab6c4b5cb001 (diff)
downloadworkshops-more-scipy-2246b4f9af4843cda97898b960ed4c9cd1136052.tar.gz
workshops-more-scipy-2246b4f9af4843cda97898b960ed4c9cd1136052.tar.bz2
workshops-more-scipy-2246b4f9af4843cda97898b960ed4c9cd1136052.zip
REF: Reformat some of the if-blocks so it's a little more clear.
--HG-- branch : scipy2010
Diffstat (limited to 'day1')
-rw-r--r--day1/session3.tex20
1 files changed, 11 insertions, 9 deletions
diff --git a/day1/session3.tex b/day1/session3.tex
index 02aef4f..26f205a 100644
--- a/day1/session3.tex
+++ b/day1/session3.tex
@@ -361,16 +361,17 @@ for record in open('sslc1.txt'):
\begin{frame}[fragile]
\frametitle{Building parsed data \ldots}
\begin{lstlisting}
-if region_code not in science:
- science[region_code] = 0
+ if region_code not in science:
+ science[region_code] = 0
-score_str = fields[6].strip()
+ score_str = fields[6].strip()
-score = int(score_str) if \
- score_str != 'AA' else 0
+ score = 0
+ if score_str != 'AA':
+ score = int(score_str)
-if score > 90:
- science[region_code] += 1
+ if score > 90:
+ science[region_code] += 1
\end{lstlisting}
\end{frame}
@@ -425,8 +426,9 @@ for record in open('sslc1.txt'):
fields = record.split(';')
score_str = fields[5].strip()
- score = int(score_str) if \
- score_str != 'AA' else 0
+ score = 0
+ if score_str != 'AA':
+ score = int(score_str)
math_scores.append(score)
\end{lstlisting}