Re: Euclid's Algorithm in Python?

2005-08-07 Thread Erik the Red
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 suppo

Euclid's Algorithm in Python?

2005-08-04 Thread Erik the Red
In Fundamental Algorithms (The Art of Computer Programming), the first algorithm discussed is Euclid's Algorithm. The only idea I have of writing this in python is that it must involve usage of the modulo % sign. How do I write this in python? -- http://mail.python.org/mailman/listinfo/python-l