summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2022-09-24 13:13:34 +0200
committerIgor Pashev <pashev.igor@gmail.com>2022-09-24 13:13:34 +0200
commit287d32d64191c7a62d9dd9c83162eac0b5db38c8 (patch)
tree30ca6c7b1b8c0f197f7d78298480b95c308f3caf
parentb70d57b1bb12cfb5b5923537cc1615fd268aecd9 (diff)
downloadgcd-master.tar.gz
Format with BlackHEADmaster
-rwxr-xr-xgcd.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcd.py b/gcd.py
index d6774a0..3690ef5 100755
--- a/gcd.py
+++ b/gcd.py
@@ -3,16 +3,18 @@
import sys
import functools
+
def gcd2(a, b):
if b == 0:
return a
else:
return gcd2(b, a % b)
+
def gcdn(ns):
return functools.reduce(gcd2, ns)
+
ints = map(int, sys.argv[1:])
gcd = gcdn(ints)
print(gcd)
-