iteration counter for GCD
<p>I have the following code for calulating the GCD of two numbers:</p>

<pre><code>def gcd(m, n):
   r = m % n
   while r != 0:
      m = n
      n = r
      r = m % n
   return n

print ("\n", "gcd (10, 35) = ", gcd(10, 35))

print ("\n", "gcd (735, 175) = ", gcd(735, 175))

print ("\n", "gcd (735, 350) = ", gcd(735, 350))
</code></pre>

<p>I would like to count the number of iterations that the algorithm has to go through before finding the GCD. I am having trouble making a for loop to determine the number of iterations.</p>

<pre><code>def gcd(m, n):
   r = m % n
   counter = 0
   while r != 0:
      m = n
      n = r
      r = m % n
      counter += 1
   return n, counter
</code></pre>

python iteration