Skip to content

Commit afb2dbb

Browse files
srvmuxjiegillet
authored andcommitted
Cleaned up the code a bit (#227)
* Changed to -= notation * Cleaned up the main function
1 parent 202a264 commit afb2dbb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

chapters/euclidean_algorithm/code/python/euclidean_example.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ def euclid_sub(a, b):
1515

1616
while a != b:
1717
if a > b:
18-
a = a - b
18+
a -= b
1919
else:
20-
b = b - a
20+
b -= a
2121

2222
return a
2323

24-
def main():
25-
print(euclid_mod(64 * 67, 64 * 81))
26-
print(euclid_sub(128 * 12, 128 * 77))
27-
28-
main()
24+
if __name__=="__main__":
25+
print('Euclidean mod: ', euclid_mod(64 * 67, 64 * 81))
26+
print('Euclidean sub: ', euclid_sub(128 * 12, 128 * 77))

0 commit comments

Comments
 (0)