REF: Reformat some of the if-blocks so it's a little more clear. scipy2010
authorChristopher Burns <chris.d.burns@gmail.com>
Sun, 27 Jun 2010 15:16:54 -0500
branchscipy2010
changeset 423 11c942a85b3f
parent 422 5f43f3020c51
child 424 2ab009c9f80a
REF: Reformat some of the if-blocks so it's a little more clear.
day1/session3.tex
--- a/day1/session3.tex	Tue Jun 22 00:03:19 2010 -0700
+++ b/day1/session3.tex	Sun Jun 27 15:16:54 2010 -0500
@@ -361,16 +361,17 @@
 \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 @@
     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}