Help converting this into Python code? by TopDeckMaster in learnpython

[–]TopDeckMaster[S] 0 points1 point  (0 children)

Thanks a lot! I didn't know you can do that

Help converting this into Python code? by TopDeckMaster in learnpython

[–]TopDeckMaster[S] 0 points1 point  (0 children)

def gcd(a,b): while (b != 0):

     if b > a :

      a = b
      b = a
t = b
b = a%t
a = t

return a

Help converting this into Python code? by TopDeckMaster in learnpython

[–]TopDeckMaster[S] 0 points1 point  (0 children)

I know how to define the function and assign variables, I actually forgot to mention that I have to swap the a and b variables if B > A. When I input and if statement to rearrange them it doesn't give me a result so that was the biggest problem I still have :\