def gcd(x, y):
(x, y) = (y, x) if x > y else (x, y)
for factor in range(x, 0, -1):
if x % factor == 0 and y % factor == 0:
return factor
What is the use of the code:
(x, y) = (y, x) if x > y else (x, y)
Isn’t it enough to get the factor through the rest of the code? I have tried to get rid of the first line and the code went wrong, but I still can’t understand it.