0

am new to python and I wanted to understand something. how does this work: (a,b) = (1,2) because I thought this assigns 1 to a and 2 to b . but when I tryed running euclid's algorithm something different happened and i didnt understand why.

  def gcd(n,m):
    while(m>0):
      (n,m) = (m , n % m)
    return n 
  print(gcd(45,126))

how is that ^ different from this:

def gcd(n,m):
   while(m>0):
      n = m 
      m = n % m
   return n 

print(gcd(45,126))

0 Answers0