diff options
Diffstat (limited to 'challenge-188/sgreen/python/ch-2.py')
| -rwxr-xr-x | challenge-188/sgreen/python/ch-2.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/challenge-188/sgreen/python/ch-2.py b/challenge-188/sgreen/python/ch-2.py new file mode 100755 index 0000000000..20d6d59ffe --- /dev/null +++ b/challenge-188/sgreen/python/ch-2.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import sys + + +def main(x, y): + # Convert the input into integers + x = int(x) + y = int(y) + + count = 0 + + while x != 0 or y != 0: + count += 1 + + # Take the smaller number from the bigger number + if x > y: + x -= y + elif y > x: + y -= x + else: + # or if they are the same, off each other + x = y = 0 + + print(count) + + +if __name__ == '__main__': + main(sys.argv[1], sys.argv[2]) |
