# HG changeset patch # User Christopher Burns # Date 1277785051 18000 # Node ID ee689f7c3122078c9d47246b725da1c8b347a0c5 # Parent 66d296ff31b9abcb2a11d4cf862865a8df3aab13 REF: Minor formatting tweaks in exercise solutions. diff -r 66d296ff31b9 -r ee689f7c3122 day1/exercise/gcd.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) diff -r 66d296ff31b9 -r ee689f7c3122 day1/exercise/pytriads.py --- 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