#!/usr/bin/env python # -*- coding: utf8 -*- """ Test of the [trace](https://docs.python.org/2/library/trace.html?highlight=list#cmdoption-trace--listfuncs) Python tool, with the factorial function.""" def factorial(n): """ Compute the factorial of n. Recursive, but not tail recursive! """ assert(n >= 0) if n == 0: return 1 else: return n * factorial(n-1) if __name__ == '__main__': # print "For n from 1 to 30, I will compute n!:\n" # for n in xrange(1, 31): # print " - for n = {:3d}, n! = {}.".format(n, factorial(n)) print "40! =", factorial(40)