我正在 MIT 6.00 学习 Python 并堆叠制作递归代码。我唯一想做的就是从x中迭代减去1,但不知道该怎么做..
这是我的代码
def gcdIter(a, b):
'''
a, b: positive integers
returns: a positive integer, the greatest common divisor of a & b.
'''
# Your code here
x = min(a, b)
if max(a, b) % min(a, b) == 0:
return x
else:
return #What comes to iterate -1 from x
请帮忙 !!!