这个python 3代码在我显然应该返回12时返回None。我无法弄明白。
from math import *
def gcd(m,n):
print("gcd: ",m,", ",n,")")
if n == 0:
print(m)
return m
else:
gcd(n,m//n)
def main():
m = 60
n = 24
result = gcd(m,n)
print(result)
main()
答案 0 :(得分:4)
更改行
gcd(n,m//n)
到
return gcd(n,m//n)