Your code is overly complicated, try this recursive implementation adapted from wikipedia:
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
It seems that you were looking for an iterative solution (the question is misleading). If that was the case, here are a couple of possible implementations, also adapted from wikipedia:
def gcd(a, b):
while b:
a, b = b, a % b
return a
def gcd(a, b):
while a != b:
if a > b:
a -= b
else:
b -= a
return a