REF: Minor formatting tweaks in exercise solutions. scipy2010
authorChristopher Burns <chris.d.burns@gmail.com>
Mon, 28 Jun 2010 23:17:31 -0500
branchscipy2010
changeset 428 ee689f7c3122
parent 427 66d296ff31b9
child 429 58a2d1766197
REF: Minor formatting tweaks in exercise solutions.
day1/exercise/gcd.py
day1/exercise/pytriads.py
--- a/day1/exercise/gcd.py	Mon Jun 28 01:37:42 2010 -0500
+++ b/day1/exercise/gcd.py	Mon Jun 28 23:17:31 2010 -0500
@@ -1,7 +1,7 @@
 def gcd(a, b):
-  if a % b == 0:
-    return b
-  return gcd(b, a%b)
+    if a % b == 0:
+        return b
+    return gcd(b, a%b)
 
 print gcd(5, 40)
 print gcd(11, 60)
--- a/day1/exercise/pytriads.py	Mon Jun 28 01:37:42 2010 -0500
+++ b/day1/exercise/pytriads.py	Mon Jun 28 23:17:31 2010 -0500
@@ -8,10 +8,11 @@
     if a % b == 0:
         return b
     else:
-        return gcd(b, a%b)
+        return gcd(b, a % b)
 
 for a in range(3, 101):
-    for b in range( a+1, 101, 2):
-        if gcd( a, b ) == 1:
+    for b in range(a + 1, 101, 2):
+        if gcd(a, b) == 1:
             is_ps, c = is_perfect_square((a * a) + (b * b))
-            if is_ps: print a, b, c
+            if is_ps:
+                print a, b, c