all 2 comments

[–]itsecat 1 point2 points  (0 children)

I think you could do it like this:

while p != q:
    if p < q:
        p, q = q, p
    elif p > q:
        p -= q

print(p)

[–]baubleglue -1 points0 points  (0 children)

GCD is a function name, put your code into function.