Euclid's Algorithm in Python?
Erik the Red
the.g.man.x at gmail.com
Sun Aug 7 17:15:54 EDT 2005
So, I did the following:
---
a=input("Give me an integer")
b=input("Give me another integer")
def gcd(a,b):
if a < b:
a, b = b, a
while b != 0:
a, b = b, a % b
return a
---
But, in the xterm, it terminates after "Give me another integer."
Is Euclid's Algorithm supposed to be implemented in such a way as to be
used as a tool to find the GCD of two integers, or have I
misinterpreted the intent of the algorithm?
More information about the Python-list
mailing list