1 Pythagodzilla 2016-11-10 10:32:45 +08:00 print result*reduce(operator.mul, [3,2,5]) 这样? |
![]() | 2 littleshy 2016-11-10 10:36:10 +08:00 ![]() reduce(operator.ixor,[3,2,5]) |
![]() | 3 woostundy 2016-11-10 10:39:25 +08:00 l = [3,2,5] reduce(lambda x,y:x^y,l) |
![]() | 4 好尴尬,刚发出来刷新发现上面有更好的写法 |
![]() | 5 zungmou OP |
7 Herobs 2016-11-10 10:47:06 +08:00 via Android reduce 或者递归 |
8 Pythagodzilla 2016-11-10 10:50:22 +08:00 @zungmou 惊了,没仔细看发现写的是*...2L 是对的... |
![]() | 9 staticor 2016-11-10 11:09:35 +08:00 顺便可以了解一些函数式编程的内容 |
![]() | 11 Zuckonit 2016-11-10 14:38:29 +08:00 reduce |