Python3 reduce () function

Function effect:

  • Factorial and calculations.

And python2 difference

  • python 3, the reduce () global function from function removed, placed in functools module used, if desired, reduce call this module
  • example:
    from functools import reduce

     

  • And you can use directly in Python2

 

Guess you like

Origin www.cnblogs.com/aszeno/p/12483690.html