- 1 # -*- coding: utf-8 -*-
- 2 """
- 3 Spyder Editor
- 4
- 5 This is a temporary script file.
- 6 """
- 7 fromfunctoolsimport reduce
- 8tadd = reduce(add,range(6))
- 9 print (tadd)
- 10tadd = reduce(add, [xforxinrange(6)ifx%2 != 0])
- 11 print (tadd)
- 12tadd = reduce(fn,[xforxinrange(9)ifx%2 != 0])
- 13 print(tadd)
来源: http://www.bubuko.com/infodetail-1978831.html