def calc_prod(lst):
def calc_multi():
return reduce(lambda x,y:x*y,lst)
return calc_multi
f = calc_prod([1, 2, 3, 4])
print f()
def calc_multi():
return reduce(lambda x,y:x*y,lst)
return calc_multi
f = calc_prod([1, 2, 3, 4])
print f()
2018-01-09
看到评论说跳跃太大,有些难,但是换个角度想,这样我们是不是可以学到更多的知识点呢,动的脑袋更多了呢,我们大家一起共勉,加油,不放弃。
2018-01-09
def calc_prod(lst):
def prod(x, y):
return x * y
def test():
return reduce(prod, lst)
return test
def prod(x, y):
return x * y
def test():
return reduce(prod, lst)
return test
2018-01-09
初学python,从老师的python入门刷到这里,突然一脸懵逼,卡了一个礼拜也没懂明白装饰器咋回事...不得不去写了个小爬虫练手||| 装饰器放在这里讲是不是跳跃性太强了??
2018-01-08
class Person:
def __init__(self,name):
self.name = name
L = ['Bart','Adam','Lisa']
L1 = [Person(p) for p in L]
L2 = sorted(L1,key = lambda x:x.name)
for p in L2: print(p.name)
def __init__(self,name):
self.name = name
L = ['Bart','Adam','Lisa']
L1 = [Person(p) for p in L]
L2 = sorted(L1,key = lambda x:x.name)
for p in L2: print(p.name)
2018-01-08
def calc_prod(lst):
def calc(x,y): return x*y
def j():
return reduce(calc, lst)
return j
f = calc_prod([1, 2, 3, 4])
print f()
def calc(x,y): return x*y
def j():
return reduce(calc, lst)
return j
f = calc_prod([1, 2, 3, 4])
print f()
2018-01-08
说实话感觉这老师讲的太一笔带过了 就不能拿到视频中多讲解下吗??还没有看书来的清楚!!!
×××××××××××差评
×××××××××××差评
×××××××××××差评
×××××××××××差评
×××××××××××差评
×××××××××××差评
×××××××××××差评
×××××××××××差评
×××××××××××差评
×××××××××××差评
2018-01-07
最赞回答 / qq_夏目_17
>>> help(sorted)Help on built-in function sorted in module __builtin__:sorted(...) sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list
2018-01-07