最赞回答 / 再见你
题主是说的答案里的打印问题是吗?其实是这样的,要先了解一下问题,Person这个类中__init__这个函数是什么意思。<...code...>这句话就意味着,p1进行了初始化,也就是说,调用了Person.__init_...
2016-02-29
最赞回答 / qq_3ice
[自问自答] 看明白了 ,辗转相除法。不断变换a,b的位置,b等于a与b的取余。直到b==0 时, 会得到他们的最小公约数,然后分子分母同时除以最小公约数达到约分的目的。gcd这个函数中,用到了递归的方法。
2016-02-28
最赞回答 / henryham
def count(): fs = [] for i in range(1, 4): def f(j): def g(): return j*j return g fs.append(f(i)) return fs f1, f2, f3 = count() print(f1(),f2(),f3())
2016-02-23
最赞回答 / no_nicheng
math.sqrt的返回值是浮点数,所以你的"if isinstance(math.sqrt(x),int)"必然是False的,所以is_sqr()一定返回None,转换为布尔型,即为Falsefilter()的第一个参数,要求为布尔型,可你调用is_sqr()都会返回False,那么必然一个数值都筛选不出来,自然返回的数据为空
2016-02-22
最新回答 / 飞雪随风
这个是Python参考文档的一部分sorted(iterable[,
cmp[, key[, reverse]]])Return a new sorted list from the items in iterable.The optional arguments cmp, key, and reverse have
the same meaning as those for the list.sort() method (described in section Mutable
Sequence ...
2016-02-19