REF: Minor formatting tweaks in exercise solutions.
--- 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