【发布时间】:2015-10-10 15:51:56
【问题描述】:
def is_power(a,b):
if a<b:
is_power(b,a)
elif a==b:
return True
else:
if a%b !=0:
return False
else:
is_power((a/b),b)
is_power(2,32)
我不知道为什么它没有显示任何内容,但是当我打印函数“is_power((a/b),b)”的最后一行时,它显示:
True
None
None
None
我在 ipython notebook 中编写并运行它,python 的版本是 2.7.10.1
【问题讨论】:
-
FunkySayu 的答案不完全正确,请看下面我的正确答案和结果。
标签: python