In Python 3.x, the reduce function already explained here has been removed from the built-ins and must now be imported from functools.

from functools import reduce
def factorial(n):
    return reduce(lambda a, b: (a*b), range(1, n+1))