Re: Simple greatest common factor script

2009-11-29 Thread fejky
I have no idea how i missed that. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple greatest common factor script

2009-11-29 Thread Patrick Sabin
I don't see how this script is able to divide by zero. If a and b switch places everything works ok. Have a look at your if-statements. It is possible, that both your if's are executed in one loop iteration (you can check this using pdb). You may want to try elif instead. - Patrick -- http:/

Simple greatest common factor script

2009-11-29 Thread fejky
Simple script that calculates greatest common factor using euclid's theorem. a = int(input("Enter a: ")) b = int(input("Enter b: ")) m = 1 while True: if m != 0: if b > a: n = b/a m = b % a print b, " : ", a, " = ", n, " i ost ", m b = m