An iterative factorial calculator in one line of code, incorporating lambda expressions, reduce, range, slicing, addition, type coercion and higher-order procedures. It could be written in a few more lines, importing
operator.mul and using that as the reduction function, but I felt that this was way cooler.
The source code is:
print reduce(lambda x,y: x*y, range(int(n)+1)[1:])
Running on my machine at home, this program can calculate 10000! (which is greater than
2**(2**16) ) in about 0.24 seconds. It is very fast.